This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java.lang.Process.exitValue() wrong


Hi,

In GCC 3.0, on both Solaris/sparc and Linux/intel, I have encountered
the following problems:

// foo.c
int main() { return 65; }

// bar.java
public class bar {
  public static void main(String[] args) throws Exception {
    Process p = Runtime.getRuntime().exec("./foo");
    p.waitFor();
    System.out.println(p.exitValue());
  }
}

// Makefile
all: foo.c bar.java
	gcc -o foo foo.c
	gcj -o bar --main=bar bar.java
	javac bar.java # JDK

// Shell interaction
[weiqi@gao] $ ./foo
[weiqi@gao] $ echo $?
65
[weiqi@gao] $ ./bar
16640
[weiqi@gao] $ java bar
65
[weiqi@gao] $ printf "%x %x\n" 65 16640
41 4100

-- 
Weiqi Gao
weiqigao@networkusa.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]