| | |
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
| Thread Tools | Search this Thread |
-xlint android api applet application array arrays automation bi binary blackberry block bluetooth chat class classes client code compile compiler component database developmenthelp eclipse error event exception fractal freeze game gameprogramming givemetehcodez graphics gui health html ide image input integer j2me j2seprojects java javac javaprojects jetbrains jni jpanel jtable julia learningresources lego linux list login loop loops mac map method methods mobile netbeans newbie notdisplaying number online oracle page print problem program programming project qt recursion scanner screen server set singleton size sms sort sql string swing system template textfields threads time title tree tutorial-sample update variablebinding windows working xor






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