waitFor returns 255 on HP Unix

J

Jakir

Hi

waitFor() method returns value 255 on HP Unix when I try to start
netscape through Runtime.getRuntime().exec("netscape") method.
I also tried to give the full path but same results.
I am able to start netscape from C program or from commandline but it
fails when I try to do same thing from Java application.

It works fine on Solaris.
What is the meaning of value 255. Where I can get the information
regarding the value returned by the waitFor() method.

Regards
Jakir
 
P

Paul Lutus

Jakir said:
Hi

waitFor() method returns value 255 on HP Unix when I try to start
netscape through Runtime.getRuntime().exec("netscape") method.

Most likely, this is a -1, but you don't say how you stored or printed it.
I also tried to give the full path but same results.
I am able to start netscape from C program or from commandline but it
fails when I try to do same thing from Java application.

Post the code and say where the application is located on your system.
It works fine on Solaris.
What is the meaning of value 255. Where I can get the information
regarding the value returned by the waitFor() method.

Uhh, the documentation?

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#waitFor()
 
J

Jakir

import java.io.IOException;


class javaHello {
public static void main(String[] args) {
try
{
Process p = Runtime.getRuntime().exec("netscape");
/* Also tried full path */
try
{
int exitCode = p.waitFor();
if(exitCode != 0)
System.out.println(exitCode);
}
catch(InterruptedException x)
{
System.err.println("Caught:" + x);
}
}
catch(IOException e)
{
e.printStackTrace();
System.out.println("Failed to start.\n" + e);
}
}
}
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top