-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b15
-
generic
-
generic
The problem is:
When I debug jtreg with built class files (main class: com.sun.javatest.regtest.Main), the checkJDK function (in com.sun.javatest/regtest/tool/Tool.java) is unable to provide an expected path of jtreg.jar (the var jtreg_jar), instead it gave the path of Tool.class, e.g. <dir-class-files>/com/sun/javatest/regtest/tool/Tool.class
JDK_Version v = jdk.getJDKVersion(new SearchPath(jtreg_jar, javatest_jar));
Moving forward, in <dir-class-files>/com/sun/javatest/regtest/config/JDK.java, getJavaSpecificationVersion calls com.sun.javatest.regtest.agent.GetSystemProperty to fetch the VERSION_PROPERTY ("java.specification.version"), and failed at the second line below:
pb.environment().put("CLASSPATH", getSysPropClassPath.toString());
pb.command(getJavaProg().getPath(), GetSystemProperty.class.getName(), VERSION_PROPERTY);
The error message is:
Error: cannot determine version for JDK: ...
There are a couple of possible solutions/fixes for this issue:
1. Use "java -Djtreg.jar=<dir-class-files> ..." to specify where the class files can be located. However "jtreg.jar" looks not a formal system property setting in "-help"
2. Detect "<dir-class-files>/com/sun/javatest/regtest/tool/Tool.class" in checkJDK function, and rectify it to be "<dir-class-files>/"
3. Use "CLASSPATH=<dir-class-files>" to specify the correct path of class files, getJavaSpecificationVersion() incorrectly overwrote the env var, fix it.
To reproduce:
~$ java -classpath ./jtreg-repo:./javatest.jar com.sun.javatest.regtest.Main Test.java
Error: cannot determine version for JDK: ...
~$ export CLASSPATH=./jtreg-repo/
~$ java -classpath ./jtreg-repo:./javatest.jar com.sun.javatest.regtest.Main Test.java
Pass
When I debug jtreg with built class files (main class: com.sun.javatest.regtest.Main), the checkJDK function (in com.sun.javatest/regtest/tool/Tool.java) is unable to provide an expected path of jtreg.jar (the var jtreg_jar), instead it gave the path of Tool.class, e.g. <dir-class-files>/com/sun/javatest/regtest/tool/Tool.class
JDK_Version v = jdk.getJDKVersion(new SearchPath(jtreg_jar, javatest_jar));
Moving forward, in <dir-class-files>/com/sun/javatest/regtest/config/JDK.java, getJavaSpecificationVersion calls com.sun.javatest.regtest.agent.GetSystemProperty to fetch the VERSION_PROPERTY ("java.specification.version"), and failed at the second line below:
pb.environment().put("CLASSPATH", getSysPropClassPath.toString());
pb.command(getJavaProg().getPath(), GetSystemProperty.class.getName(), VERSION_PROPERTY);
The error message is:
Error: cannot determine version for JDK: ...
There are a couple of possible solutions/fixes for this issue:
1. Use "java -Djtreg.jar=<dir-class-files> ..." to specify where the class files can be located. However "jtreg.jar" looks not a formal system property setting in "-help"
2. Detect "<dir-class-files>/com/sun/javatest/regtest/tool/Tool.class" in checkJDK function, and rectify it to be "<dir-class-files>/"
3. Use "CLASSPATH=<dir-class-files>" to specify the correct path of class files, getJavaSpecificationVersion() incorrectly overwrote the env var, fix it.
To reproduce:
~$ java -classpath ./jtreg-repo:./javatest.jar com.sun.javatest.regtest.Main Test.java
Error: cannot determine version for JDK: ...
~$ export CLASSPATH=./jtreg-repo/
~$ java -classpath ./jtreg-repo:./javatest.jar com.sun.javatest.regtest.Main Test.java
Pass