JDK-6638501 : Regression with Javac in JDK6 U4 b03?
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 2.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2007-12-06
  • Updated: 2011-12-19
  • Resolved: 2008-01-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u4 b12Fixed 7Fixed OpenJDK6Fixed
Related Reports
Relates :  
Description
We have a tool wscompile in Application Server. wscompile tool generates some Java classes and compiles them.The generated classes use some api(let's say javax.xml.rpc.Service), which are in the classpath. The api classes are bundled in javaee.jar and j2ee.jar has reference to javaee.jar in the classpath manifest. Only j2ee.jar is set in the classpath of wscompile. 
Importantly, Javac fails to compile with JDK6 U4 b03 but works fine with U4 b02 saying it cant find the api classes.

Is there any change in b03 thats causing this problem?

I will try to attach a testcase soon, I am filing this to see if you can recollect any changes in this area so that we can decide on if we should ship App Server SDK.
I am attaching a testcase to show how Wscompile tool in jaxrpc calls Javac.
Set JAVA_HOME and run  "ant build" to see the issue.
By passing -DnonBatchMode, it worked.
A new standalone test is added and reproduces the problem.
If Javac is invoked multiple times, it happens

Comments
WORK AROUND Possible scenarios to reproduce this problem: 1. In the more common case, jarfile1 must have jarfile2 listed in its Class-Path manifest entry, with only jarfile1 listed on the classpath. Two compilations in the same JVM space require classes from the jar file listed in the Class-Path entry. You have two ant javac targets, the second requiring something loaded in the first, under the two conditions above. 2.In the second (less common) case, jarfile1 must have jarfile2 listed in its Class-Path manifest entry, with only jarfile1 listed on the classpath. And your program calls javac (com.sun.tools.javac.Main.compile() ) twice. Workarounds are as follows: 1. Put all the jar files explicitly on the classpath. 2. In the (more likely) case that ant is being used, such as with multiple build targets in ant, you can workaround by either forking the javac target in the build.xml file or by putting both jar files on the classpath. 3. If the compiler is called twice from one piece of code (for example, the application itself created compiler objects and called com.sun.tools.javac), you would pass the -DnonBatchMode option to the compiler.
13-12-2007

EVALUATION There were changes in the way zip files are cached in javac. This changes are performance improvements. There are few flags disabling these optimizations partially. Add the -DnonBatchMode to the command line invokind the VM running the compiler. If this doesn't solve the problem add an extra flag -DcheckZipIndexTimestamp. If these two flags dont help add a third flag -DuseJavaUtilZip
06-12-2007