netbeansidecommand-line-interfacenetbeans-plugins

How to install a NetBeans plugin via CLI?


Question:
Is there a way to install a downloaded NBM (Netbeans Module) into an already installed Netbeans IDE via CLI?

Current setup
Netbeans 12.3 with Windows 10
Netbeans 12.3 with Linux Mint 20.1

Relevant scenario
If the question comes to your mind 'why aren't you just using the GUI?' or anything like that. Think of the following scenario. When working on an air gapped network with 50 computers you're the one having to install Netbeans plugins on all of that PCs. You're able to put files on those PCs and execute a command via console and you don't want to run around all the buildings and clicking through the process.

Thank you very much in advance.


Solution

  • I think I found a solution. I'll post it here to reflect my research because I've never found a answer on stackoverflow.

    When Netbeans is already installed you can use the --help parameter like:
    C:\Program Files\NetBeans\netbeans\bin\netbeans64.exe --help

    This lists lot of available parameters (which I haven't found a list of on the web) like (shortened):

    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
    

    In my case the solution was to use the --install parameter pointing to the jar file to install.
    Be aware that the NBM files are just containers containing the jar file and some more meta data files like config xml files. You're able to open it via 7zip for example. And you'll have to take care of all the dependencies yourself.