| | |
Need help to run Command Prompt from java program
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2006
Posts: 164
Reputation:
Solved Threads: 10
I don't know the exact solution. I may try once I go home. Just few suggestions:
1. Since Java 1.5 a new class ProcessBuilder has been introduced to replace exec(). So might be a good idea to try with ProcessBuilder and see if it works.
2. A work around can be to take user input, execute it, and display it. Might be a lot of work. You may find this useful: http://forums.sun.com/thread.jspa?th...sageID=4351862
1. Since Java 1.5 a new class ProcessBuilder has been introduced to replace exec(). So might be a good idea to try with ProcessBuilder and see if it works.
2. A work around can be to take user input, execute it, and display it. Might be a lot of work. You may find this useful: http://forums.sun.com/thread.jspa?th...sageID=4351862
A Perfect World
•
•
Join Date: Oct 2008
Posts: 26
Reputation:
Solved Threads: 1
Hi manisha ,
I tried the same above but it's not opening the command prompt ,
it's compiled successfully , but it is hanging after that ,
i tried this using cygwin environment in windows operating system..
I tried the same above but it's not opening the command prompt ,
it's compiled successfully , but it is hanging after that ,
•
•
•
•
sekharbabuk@sekharbabuk /cygdrive/c/j2sdk1.4.2_16/bin $ javac RunUnixCommand.java sekharbabuk@sekharbabuk /cygdrive/c/j2sdk1.4.2_16/bin $ java RunUnixCommand -----------###------------------------------------------ Command = cmd.exe -------------------------------------------------------- File Found : Microsoft Windows XP [Version 5.1.2600] File Found : (C) Copyright 1985-2001 Microsoft Corp. File Found :
i tried this using cygwin environment in windows operating system..
![]() |
Similar Threads
- How to run a *.exe file in Java (Java)
- put the Dos 's command into java program? (Java)
- Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error (Java)
- How to run c++ program through command prompt? (C++)
- Running Java Program outside an IDE (Java)
- java.lang.NoSuchMethodError: (Java)
Other Threads in the Java Forum
- Previous Thread: Updating JAR applications
- Next Thread: Illegal escape character Error
Views: 4979 | Replies: 16
| Thread Tools | Search this Thread |
Tag cloud for Java
-xlint android api apple applet application arguments array arrays automation binary block bluetooth chat class classes client code compile component database developmenthelp draw eclipse encode error event exception file fractal freeze game gameprogramming givemetehcodez graphics gui helpwithhomework html ide image input integer iphone j2me j2seprojects java javac javaprojects jmf jni jpanel julia lego linux list loop loops mac map method methods mobile netbeans newbie notdisplaying number object online oracle print problem program programming project recursion scanner screen server set singleton size sms socket sort sql string swing system template test textfields threads time title transfer tree tutorial-sample update windows working






late, but... for anyone still "listening"...