ant built incompatible class files for 1.1 applet

Hi, for a long time we build our class files for our applet with ant using JDK 1.3.1.

For some days I have been testing with IDEA 3( and we will for sure replace our JBuilder Prof. by it).

I haven't actually expected any problems from the Ant integration because IMO it's just about starting an external tool. But if we build our Applet JAR from the IDEA integrated Ant the class files cannot be understood by the browser's built-in VMs. IE logs ClassNotFoundExceptions whereas Netscape logs a "Bad major version number java.lang.ClassFormatError".
On the other hand if we configure the browsers to use the Java Plugin it works.

So have the class files been compiled by an incompatible Java VM? I have also a JDK 1.4.0 on my PC (Windows NT 4).

I am not an Ant expert but I think any installed Ant should evaluate the JAVA_HOME environment variable for the JDK used for compilation. And this the JDK 1.3.1 in our case.

Has anyone ideas what is happening?


评论操作 固定链接

We ran into similar problems and solved it this way in our build.xml file:

... appropriate include/exclude lines goes here ]]>

The important one's here are "executable" and "fork" which were needed to make it work. This way Ant forks a new process that runs "executable". It acutally invokes the 1.1 JDK compiler. If you only set "target" to 1.1 it uses javac from your current JDK, in your case 1.3.1.

I'm afraid I can't explain why this happens, but this is a work-around for it. Hope it helps.

评论操作 固定链接

Thanks, the meantime I played around with the Ant integration properties IDEA provides and found this solution:

If I check "Execution: Run under custom JDK" and choose my JDK 1.3.1 and check "Additional Classpath: include XML Parser" the code compiles fine.