Dear all,
Could you tell me how to go about executing MSDOS commands thru Java. I tried with the Process class but it gives an error:2.
Could anyone please advise.
Rajnesh
0
Newbie Poster
Recommended Answers
Jump to PostYou should be able to use Process:
Process p = Runtime.getRuntime().exec(command);
command is a string you pass.
What's the error you're recieving?
Jump to PostYou will need to start a command interpreter in order to launch operating system level commands.
Under win32 that's done using the "cmd" command.
For example "cmd dir" would execute a dir command.The entire system is rather tricky, I've never really gotten the hang of it (but then …
Jump to PostI've done a bit more R&D (you got me interested ;) ), turns out it's trickier than it looks because you need to start a process and then start a process in that process and catch the output of that sub process.
As a minimum you'd end up with …
All 10 Replies
server_crash
64
Postaholic
Rajnesh
0
Newbie Poster
jwenting
1,889
duckman
Team Colleague
Rajnesh
0
Newbie Poster
Rajnesh
0
Newbie Poster
jwenting
1,889
duckman
Team Colleague
aruntells
-2
Newbie Poster
stephen84s
commented:
Unnecessarily reviving an ancient thread
-1
stultuske
commented:
not really adding anythin, reviving a dead thread, not following forum standards, .. take your pick
-1
prianka
0
Newbie Poster
prathimat
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.