如何通过 CLI 安装 NetBeans 插件?

问题描述

问题:
有没有办法通过 CLI 将下载的 NBM(Netbeans 模块)安装到已安装的 Netbeans IDE 中?

当前设置
Netbeans 12.3 与 Windows 10
Netbeans 12.3 和 Linux Mint 20.1

相关场景
如果您想到“为什么不只使用 GUI?”或类似问题。想想下面的场景。在有 50 台计算机的气隙网络上工作时,您必须在所有这些 PC 上安装 Netbeans 插件。您可以将文件在这些 PC 上并通过控制台执行命令,而您不想绕过所有建筑物并单击整个过程。

非常感谢您。

解决方法

我想我找到了解决办法。我会在这里发布它以反映我的研究,因为我从未在 stackoverflow 上找到答案。

如果已经安装了 Netbeans,您可以使用 --help 参数,例如:
C:\Program Files\NetBeans\netbeans\bin\netbeans64.exe --help

这列出了许多可用参数(我在网上没有找到列表),例如(缩短):

General options:
  --help                show this help
  --jdkhome <path>      path to JDK
  --console new         open new console for output

Module reload options:
  --reload /path/to/module.jar  install or reinstall a module JAR file

Additional module options:
  --modules
  --refresh                 Refresh all catalogs
  --list                    Prints the list of all modules,their versions and enablement status
  --install <arg1>...<argN> Installs provided JAR files as modules
  --disable <arg1>...<argN> Disable modules for specified codebase names
  --enable <arg1>...<argN>  Enable modules for specified codebase names
  --update <arg1>...<argN>  Updates all or specified modules
  --update-all              Updates all modules

Core options:
  --fontsize <size>     set the base font size of the user interface,in points
  --userdir <path>      use specified directory to store user settings
  --nosplash            do not show the splash screen

就我而言,解决方案是使用 --install 参数指向要安装的 jar 文件。
请注意,NBM 文件只是包含 jar 文件和更多元数据文件的容器,例如配置xml文件。例如,您可以通过 7zip 打开它。 并且您必须自己处理所有依赖项。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...