[nbj2ee] NetBeans screw up command line :-)

  • From: "KKop" < >
  • To:
  • Subject: [nbj2ee] NetBeans screw up command line :-)
  • Date: Wed, 28 Mar 2012 19:34:34 +0000

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?

Thanks.


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

            BufferedReader input = new BufferedReader(new InputStreamReader(
                    pr.getInputStream()));
            
            BufferedReader stdError = new BufferedReader(new 
                 InputStreamReader(pr.getErrorStream()));

            String line = null;

            while ((line = input.readLine()) != null) {
                System.out.println(line);
            }
            
            // 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) {
                System.out.println(line);
            }

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

        } catch (Exception e) {
            System.out.println(e.toString());
            e.printStackTrace();
        }








[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 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close