Revision as of 14:17, 9 December 2009 by T h (Talk | contribs)

Can I associate a file type with NetBeans to be able to open files of that type from File Explorer?

Yes, you can.

NetBeans 6.0+

Just pass the name of the file to be opened as the only argument. For example:

   netbeans MyFile.java 

The --open option described below works, too.

Older Releases

You need to pass the file via the --open <filename> option.

You can start the NetBeans IDE and have it open a file you specify in the command line as an argument to the --open option. If there is an already running instance of the IDE, the file will simply open in this instance.

In addition, you can specify the line at which the file should open as --open <filename:line> where line is the line number starting from 1.

The same command can be used to create an association for files of specific types in the file manager.

Note that the --open switch is mandatory. As of now, it is not possible specify the files to be opened as a simple argument list. For example, 'netbeans a.java' won't work.


  • To start NetBeans and have it open a.java:
     netbeans a.java             (NetBeans 6.0+)
     netbeans --open a.java      (NetBeans 4.0+) 
  • To start NetBeans and have it open file b.java at line 67:
     netbeans b.java:67          (NetBeans 6.0+)
     netbeans --open b.java:67   (NetBeans 4.0+)
  • To create an association for .java files in Windows File Explorer:
    1. In File Explorer, select Tools | Folder Options.
    2. Select the File Types tab.
    3. Find the Java file type or create one, if it doesn't exist yet.
    4. Click the Advanced button
    5. Create a new action called Open and specify the command like this:
   "C:\Program Files\netbeans-4.1\bin\netbeans.exe" --open %1 

  Applies to: NetBeans 4.0, 4.1, 5.0, 5.5, 5.5.1, 6.x
  Platforms: All (file association registration may vary among platforms)
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo