-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Describe the issue
Java system properties are changed from native image to OpenJDK. Some properties are removed, and some properties' values are changed. When user call System.getProperty
, he/she may expect a consistent value with OpenJDK version. Or at least a warning is reported at build time. We propose #2834 to fix this issue.
Steps to reproduce the issue
Run this test with OpenJDK will print out the java.home location, but with native image will get a NPE.
import java.io.File;
public class TestUnsupportedProperty {
public static void main(String[] args){
boolean suc = true;
try{
testSunBootClassPath();
} catch ( Throwable t){
t.printStackTrace();
suc = false;
}
if (!suc){
System.exit(1);
}
}
private static void testSunBootClassPath(){
String ret=System.getProperty("java.home");
File path = new File(ret);
System.out.println(path.getAbsolutePath());
}
}
Describe GraalVM and your environment:
- GraalVM version: Latest code from master branch.
- JDK major version: 8, 11
More details
The exception thrown:
java.lang.NullPointerException
at java.io.File.<init>(File.java:278)
at test.property.TestUnsupportedProperty.testSunBootClassPath(TestUnsupportedProperty.java:48)
at test.property.TestUnsupportedProperty.main(TestUnsupportedProperty.java:36)
aalmiray, demkom58 and sotasan