Can I associate a file type with NetBeans to be able to open files of that type from File Explorer?
Yes, you can. Just pass the name of the file to be opened as the only argument. For example:
The same command can be used to create an association for files of specific types in the file manager.
You can also use the explicit --open option for clarity, and pass more than one file; for example, on Unix:
find src -name \*.java -print0 | xargs -0 netbeans --open
If there is an instance of the IDE already running, the file will simply open in this instance and the command will exit. You may need to pass the --userdir option to match the user directory of the running IDE.
In addition, you can specify the line at which the file should open (line numbers start at 1):
To create an association for .java files in Windows File Explorer:
- In File Explorer, select Tools | Folder Options.
- Select the File Types tab.
- Find the Java file type or create one, if it doesn't exist yet.
- Click the Advanced button
- Create a new action called Open and specify the command like this:
"C:\Program Files\netbeans\bin\netbeans.exe" --open %1
Applies to: NetBeans 6.0+
Platforms: --open is available on all platforms. File association registration may vary among platforms (not confirmed for Windows 7).