is it a bug of libgcj ?

bbskill bbkills@tom.com
Fri Aug 5 06:19:00 GMT 2005


hello all ,
my gcj is gcc/gcj4.1, compiled by myself. I meet a strange problem
showed below:
FileTest.java
import java.io.*;
public class FileTest {
public static void main(String[] args) {
File file = new File("/home/bbskill");
System.out.println(file.listFiles()[0].getName());
}
}
I compiled using gcj --CLASSPATH=. --main=FileTest FileTest.java -o FileTest
then I execute it :./FileTest
Exception in thread "main" java.lang.NullPointerException
at java.io.File.<init> (File.java:370)
at java.io.File.<init> (File.java:419)
at java.io.File.performList (natFile.cc:238)
at java.io.File.listFiles (File.java:853)
at FileTest.main (FileTest)

----------------------------------
Then I change FileTest.java to this :
import java.io.*;
public class FileTest {
public static void main(String[] args) {
File file = new File("/home/bbskill/glftp");
System.out.println(file.listFiles()[0].getName());
}
}
also compiled using gcj --CLASSPATH=. --main=FileTest FileTest.java -o
FileTest
then I execute it :./FileTest,
then it output the right name of the first file Name of my
/home/bbskill/glftp directory.

PS: /home/bbskill/ is my userHome directory .
Why two examples behavior so different ? why the first example throws a
java.lang.NullPointerException?
is a bug of libgcj??
Thank you for your help !!

<http://www.kaffe.org/%7Estuart/japi/htmlout/h-jdk14-libgcj.html#pkg_javax_sound_midi>



More information about the Java mailing list