|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
Is there any way to execute remote programs on a server using a Java servlet? I am writing a web based assessment package which must allow for assembly language programs to be compiled and run, probably on the same machine as the server.
------------------ -- Mark Ogden |
|
#2
|
|||
|
|||
|
Yes, you can do this like so (this example starts a subshell and executes a command) :
String[] command = {"/usr/bin/ksh","-c","ls"}; Process p = Runtime.getRuntime().exec(command); BufferedReader results = new BufferedReader(new InputStreamReader(p.getInputStream())); String nextLine = results.readLine(); while (nextLine != null) { out.println(nextLine+"<br>"); nextLine = results.readLine(); } You will have to put this in a try/catch block. Success, Ton |
|
#3
|
|||
|
|||
|
That's brilliant! Thanks very much. Works a treat!
------------------ -- Mark Ogden |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Remote program execution |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|