UnsupportedClassVersionError with

247 views
Skip to first unread message

pepe

unread,
Feb 15, 2012, 4:25:43 PM2/15/12
to zxing
I am trying to generate a QRCode image, Eclipse send
UnsupportedClassVersionError: Bad version number in .class file, when
the next instruction is performed:

Line 108 is the return:

private BitMatrix createMatrix() throws WriterException {
return new QRCodeWriter().encode(text,
com.google.zxing.BarcodeFormat.QR_CODE, width, height);
}

I am using J2se 1.5 and download the zxing 2.0

¿Should I use an older zXing version?

Regards

This is the complete exception:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at net.glxn.qrgen.QRCode.createMatrix(QRCode.java:108)
at net.glxn.qrgen.QRCode.stream(QRCode.java:99)
at Etiqueta2d.main(Etiqueta2d.java:14)

Sean Owen

unread,
Feb 15, 2012, 4:36:55 PM2/15/12
to zx...@googlegroups.com
UnsupportedClassVersionError has nothing to do with a library. It means you compiled for, probably, Java 6 and are trying to use the bytecode on Java 1.5. Compile for 1.5; I think there are few if any code changes you would need to make to make that work. Or, update to Java 6.

pepe

unread,
Feb 15, 2012, 5:57:33 PM2/15/12
to zxing
Thank you Sean, I compiled again and this is what Java return:

bad class file: C:\ARCHIV~1\APACHE~1\TOMCAT~1.0\common\lib
\core.jar(com/google/zxing/WriterException.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of
the classpath.
import com.google.zxing.WriterException;

¿Any idea how to solve this?


Regards

Sean Owen

unread,
Feb 15, 2012, 6:42:01 PM2/15/12
to zx...@googlegroups.com
(See my previous answer.)
Reply all
Reply to author
Forward
0 new messages