[nbj2ee] Re: NetBeans screw up command line :-)

  • From: John Yeary < >
  • To:
  • Subject: [nbj2ee] Re: NetBeans screw up command line :-)
  • Date: Fri, 30 Mar 2012 13:22:35 -0400

This is the wrong forum for these types of questions, please use the  " target="_blank"> mailing list.


John Yeary
NetBeans Dream Team
President Greenville Java Users Group
Java Users Groups Community Leader
Java Enterprise Community Leader



"Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt

On Wed, Mar 28, 2012 at 3:34 PM, KKop < "> > wrote:
I am executing a batch file from the command line, from within java.

The batch file runs a ruby file on a PC on our network. Actual CL: "C:\CreateOrder.bat"  Within the batch file, I change to a mapped drive, then execute a ruby script on that mapped drive.

In Java, I run the batch file from the command line, accessed through the RunTime (see below).   This was originally developed in Eclipse, and works fine there.  I recently moved to NetBeans, and now the batch file will still run, but the command line has no knowledge of any mapped drives.

I did some tests where I have NetBeans open up a CL window, and found I can not change to, or list the contenets of any mapped network drive.

The most obvious difference between Eclipse and Netbeans is that the CL window in NetBeans opens with the NetBeans project folder as its target: C:\nbprojects\<projectname>.

So far, I have tried:
- running the commands within the batch file with UNC paths instead of mapped drives
- making sure the project folder permissions for NetBeans are the same as Eclipse
- running a CL that open a cmd window first, then execute the batch file: (cmd /c start C:\CreateOrder.bat).

I am at a loss here.  I must be missing something simple.  How can I run a CL from NetBeans, where the CL has access to my mapped drives?


try {
           Runtime rt = Runtime.getRuntime();
           Process pr = rt.exec(commandLine);

           BufferedReader input = new BufferedReader(new InputStreamReader(

           BufferedReader stdError = new BufferedReader(new

           String line = null;

           while ((line = input.readLine()) != null) {

           // read any errors from the attempted command
           System.out.println("Here is the standard error of the command (if any):\n");
           while ((line = stdError.readLine()) != null) {

           int exitVal = pr.waitFor();
           System.out.println("Exited with code " + exitVal);

       } catch (Exception e) {

[nbj2ee] NetBeans screw up command line :-)

KKop 03/28/2012

[nbj2ee] Re: NetBeans screw up command line :-)

John Yeary 03/30/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 25 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150226.965aeb8). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm