exec

H

Hemal Pandya

If I run this code in windows all is ok ( START
http://localhost:8087/AuleServer ), but if try to execute it in

Runtime rt=Runtime.getRuntime();
try {
Process browser=rt.exec("START
http://localhost:8087/AuleServer" );
} catch(Exception e) {
System.out.println( e.getMessage()
);
}

I read : ... error=2

Runtime.exec executes an external command. START is a command internal
to cmd.exe. Prefix it with "cmd /c " to invoke the command interpreter
and instruct it to start the url.

Of course, this will work only on platforms which has external command
cmd that knows what to do with /c switch and start.
 
R

Roedy Green

Process browser=rt.exec("START
http://localhost:8087/AuleServer" );

your problem is exec is a bare bones launcher. It can only handle raw
exe and com files. To handle anything else you need to launch a
command processor such as cmd.exe and pass it your bat file, url etc.
as a parameter and let it figure out how to launch it.

See http://mindprod.com/jgloss/exec.html for details.

--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top