-
Notifications
You must be signed in to change notification settings - Fork 202
Java exception during js.minify #9
Comments
I'm not the king of Java, but from what I can tell it is down to the Java versions in play. Knowing what's happening at that point in the build script, I'd guess the version of Closure Compiler we ship with the build script must be compiled on a later version of Java than the one you have on that system. |
I've test the build script on my machine at work (previous attempt was on my home machine) and it works fine on OS X 10.6 (running Java version 1.6.0_29). My 10.5 machine is running Java version 1.5.0_30 so that must be the issue. Obviously there aren't many 10.5 machines out there anymore, but should this be noted in the wiki? |
Yeah, it's definitely something to document. Can you try compiling the tools (closure compiler and yui compressor) on your machine? That should solve this issue and I'd like to be sure that's the case before documenting it. |
I just tried compiling the closure compiler version 1324 and it requires Java version 1.6 to compile. Looks like Java 1.6 will not run on PowerPC macs or 32 bit Intel Macs according to http://blogs.oracle.com/cmar/entry/java_1_6_finally_available. There is a project called SoyLatte that looks like it would provide Java 1.6 support for 10.5 Macs. I'll try that out later and see if it will work as an alternative. |
Thanks for taking a shot with that. If it doesn't work, we can potentially instruct people in your situation to switch back to YUI Compressor for js minification. |
I'm getting a similar error too, but for minifying css. That's the error: [apply] Exception in thread "main" java.lang.reflect.InvocationTargetException What could that be? |
@farneman did you ever get a chance to look at that other option for the compatibility issue? I'd like to know if there's some workaround that we can document. There's not much we can do if 1.6 is required for Closure Compiler. |
@roblarsen After some digging it looks like SoyLatte may provide a solution for Intel users on 10.5, I'm not able to test that though. However the SoyLatte version for PowerPC's is Java 1.7 not 1.6, so it's not any more help. Perhaps someone more knowledgeable with Java can find a work around, but it looks like PowerPC Macs will just not be able to use the build script with the Closure Compiler. |
@roblarsen I've posted a pull request to update the README to not the Java 1.6 requirement. |
Thanks. I merged the pull request. I might go back and write up some more detailed requirements, but for now I'm happy to just have the general issue documented. |
I'm experiencing something similar and wondering if anyone could help me troubleshoot. During the -js.main.concat task get what appears to be an UnsupportedClassVersion Error, but the error message is interspersed with other output:
This translates to:
For reference I'm on
Here's the output from java -version:
|
This is issue was resolved for me by installing the Java 7 JDK. |
Had the same issue as henryrose, fix worked. (But is kinda heavyweight.) |
This should be fixed in the 1.0 branch. The issue is the version of Java the ScriptsToConcat file is compile with. You can fix it easier by recompiling that file locally. |
It doesn't seem to be fixed on the actual repo version, at least for mac OS 10.7.4 with Java 1.6.0_37. |
It's not fixed in the main version. I'm only a week or two away from getting everything sorted so I've basically stopped work on the main version. Adding it to the docs for a couple of weeks is a good idea. |
While running the build script I'm getting the following error:
-js.all.minify:
[echo] Minifying scripts
[copy] Copying 2 files to /Users/Josh/Server/lee-drugs/intermediate/js
[apply] Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
[apply] at java.lang.ClassLoader.defineClass1(Native Method)
[apply] at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
[apply] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[apply] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[apply] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[apply] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[apply] at java.security.AccessController.doPrivileged(Native Method)
[apply] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
[apply] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[apply] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
[apply] Result: 1
[apply] Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
[apply] at java.lang.ClassLoader.defineClass1(Native Method)
[apply] at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
[apply] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[apply] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[apply] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[apply] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[apply] at java.security.AccessController.doPrivileged(Native Method)
[apply] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
[apply] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[apply] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
[apply] Result: 1
[apply] Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
[apply] at java.lang.ClassLoader.d
[apply] efineClass1(Native Method)
[apply] at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
[apply] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
[apply] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[apply] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[apply] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[apply] at java.security.AccessController.doPrivileged(Native Method)
[apply] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
[apply] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
[apply] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[apply] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
[apply] Result: 1
Which results in the build failing during -.js.scripts.concat.
I'm guessing this means theirs an issue with some aprt of the script trying to use a version of Java that I don't have. Any ideas?
I'm running the build script on an older PowerPC Mac running 10.5, so that may be the problem.
The text was updated successfully, but these errors were encountered: