Opening a File From the Command Line

I learned a neat trick in the dev@ruby.netbeans.org mailing list this week, one that I wish I had discovered long ago -- how to open a file in the Netbeans editing area from the command line, even if the file is not in an opened project.

Make sure that the NetBeans bin directory is in your path. Then use the following command to open the file in the NetBeans editing area.

netbeans --open file

Even better, make an alias:

alias nb='netbeans --open '

Then you can simply type nb file. The command will start up the NetBeans IDE if necessary. If the IDE is already open, the command simply opens the file and pops it to the front of the editing area.

If you are using Windows, you can also do the following to open a file in the IDE.

  1. Right-click on a file in an explorer window.
  2. Choose Open With > Choose Program.
  3. Select NetBeans from the program list. If NetBeans is not on the program list, click Browse, navigate to and select netbeans-install-dir/bin/netbeans.exe, and click open.
  4. Click OK. The file opens in the IDE. Sometimes the IDE does not show the file's tab right away so it looks like the file has a different name. If you hover over another tab, the file's tab usually appears.

For more information, see wiki.netbeans.org/wiki/view/FaqCliOpen

Comments:

Is this cool ?
+1

Posted by anjan bacchu on August 29, 2007 at 06:03 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

divas

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today