1

Just wondering, for all of you Netbeans fans:
I'm inside netbeans and I opened up the Terminal emulator (using Windows 7 64bit). The project is open and I want to create a new file in the current direcorty, so I use the 'touch' command

touch filename.extension

When I use the 'ls' command, I see the file is created (verified by looking at the folder in the project. Question is, is there any way to create a new file and have it opened automatically (or, manually with a command) in the netbeans editor? I used the --open command but it says:

open: command not found

running which open shows:

    which: no open in (/usr/bin:/cygdrive/c/Program Files (x86)/AMD
APP/bin/x86_64:/cygdrive/c/Program Files (x86)/AMD APP/bin/x86:/cygdrive/c/Program File
                 (x86)/EasyPHP-DevServer-13.1VC11/binaries/php/php_runningversion:/cygdrive/c/Program 
                Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common
                 Files/Microsoft Shared/Windows
                 Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/
                System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/
                c/Program Files/Dell/DW WLAN Card:/cygdrive/c/Program Files (x86)/
            ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/Program Files/WIDCOMM/
                Bluetooth Software:/cygdrive/c/Program Files/
        WIDCOMM/Bluetooth Software/syswow64:/cygdrive/c/Program Files (x86)/Common Files/
    Intuit/QBPOSSDKRuntime:/cygdrive/c/Program Files (x86)/QuickTime/QTSystem:/cygdrive/c/
    Program Files 
            (x86)/Windows Live/Shared:/cygdrive/c/Program Files/Java/jdk1.7.0_17/bin)
Hill
  • 419
  • 1
  • 7
  • 12

4 Answers4

2

In windows:

  1. Step 1: Find the netbeans.exe on your system. In my PC, netbeans.exe location is C:\Program Files\NetBeans 8.0.2\bin.

  2. Step 2: Add C:\Program Files\NetBeans 8.0.2\bin in your Environment Variables. If you don't know how to add something in Environment variable then click here.

  3. Step 3: re-open your command line and run this command start netbeans index.html in here index.html which you want to open in netbeans.

Md Mehedi Hasan
  • 1,733
  • 1
  • 21
  • 34
1

To my knowledge, there is no pre-defined command for the behavior you are after. However, you can create a custom command using a bash function (assuming you are using bash)

#!/bin/bash
function touchopen(){
    if [ ${1} ];then
        touch ${1} && open -a "/path/to/Netbeans.app" ${1}
    else
        printf "No input file\n"
    fi
}

open -a "path" "file" just opens the file using the application "path"

coln
  • 123
  • 7
  • What system are you using? Try the command `which open` to see if/where you have the open command. – coln Feb 01 '14 at 22:00
  • I'm on windows 7 64bit, the terminal emulator is actually built-in with netbeans 8.0 Beta. Not sure if that makes a difference. which open says: no open in..... look at the edited question for more details – Hill Feb 01 '14 at 23:04
  • Ahh I see. From the output of which it looks like you do not have an `open` command installed somehow. I would check to make sure everything is up-to-date. I'm not privy with the terminal emulator in Netbeans, but you might want to read [here](http://wiki.netbeans.org/TerminalEmulator) for more information. – coln Feb 01 '14 at 23:52
0

Two steps to make this work

Step One: Make sure that the Netbeans is set as the default program to open all the files with extensions that you work on in netbeans (.html,.php, .etc)

Step Two: Use command called 'cygstart' like this cygstart filename.ext. You can also read here if you wish to use 'open' as an alias of cygstart

Community
  • 1
  • 1
Hill
  • 419
  • 1
  • 7
  • 12
0

If you are using cygwin utility then use the following one,

cygstart <filename.extension>

Please choose netbeans as the default file open software

IamRex
  • 1