Results 1 to 5 of 5
- 03-26-2011, 04:14 PM #1
Member
- Join Date
- Mar 2011
- Location
- Alphen aan den Rijn, The Netherlands
- Posts
- 3
- Rep Power
- 0
- 03-28-2011, 03:19 PM #2
Member
- Join Date
- Mar 2011
- Location
- Alphen aan den Rijn, The Netherlands
- Posts
- 3
- Rep Power
- 0
I know the coding isnt complete, but when i try to lauch it i get an exception:Java Code:try { Runtime rt = Runtime.getRuntime(); String command = "telnet 192.168.2.254"; Process pr = rt.exec(command); BufferedReader processOutput = new BufferedReader(new InputStreamReader(pr.getInputStream())); BufferedWriter processInput = new BufferedWriter(new OutputStreamWriter(pr.getOutputStream())); String commandToSend = ""; processInput.write(commandToSend); processInput.flush(); int lineCounter = 0; while (true) { String line = processOutput.readLine(); if (line == null) { break; } System.out.println(++lineCounter + ": " + line); } processInput.close(); processOutput.close(); pr.waitFor(); } catch (Exception x) { x.printStackTrace(); } }
java.io.IOException: Cannot run program "telnet": CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden (system cant find file)
at java.lang.ProcessBuilder.start(ProcessBuilder.java :460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:431)
at java.lang.Runtime.exec(Runtime.java:328)
at testcmdsender.Main.main(Main.java:12)
help? =D
- 03-29-2011, 04:54 AM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
It appears that 'telnet' is not in the path, since the exception is complaining that it can't find it. You might try giving a full path to telnet, or ensuring your environment is properly set up from the account launching it.
- 03-29-2011, 08:11 AM #4
Member
- Join Date
- Mar 2011
- Location
- Alphen aan den Rijn, The Netherlands
- Posts
- 3
- Rep Power
- 0
Thnx, I'll try that. On the other hand, i have no clue how to get my envirement "ready". Could you spare some tips? :) Im totally new to threading within java.
- 03-29-2011, 11:34 PM #5
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Similar Threads
-
java program for running the command prompt commands
By leoanto in forum Advanced JavaReplies: 2Last Post: 03-26-2011, 03:57 PM -
New Command prompt
By jmga9 in forum New To JavaReplies: 4Last Post: 11-10-2010, 01:53 AM -
log message from command prompt
By tedy2808 in forum New To JavaReplies: 5Last Post: 08-25-2010, 11:04 AM -
help me!!!! about command prompt..
By kureikougaiji in forum New To JavaReplies: 2Last Post: 11-13-2008, 06:15 PM -
problem when I try to compile a program from command prompt
By osval in forum Advanced JavaReplies: 2Last Post: 08-06-2007, 09:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks