| | |
Need help to run Command Prompt from java program
![]() |
•
•
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 |
2dgraphics account android api apple applet application arguments array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class client code color component count database derby design eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui homework html ide if_statement image integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia keyword linux list macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object open-source os problem producer program programming project projectideas property read recursion reference replaysolutions ria scanner search server set size sms sort sourcelabs splash sql sqlite stop string swing threads transforms tree ui unicode validation windows






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