ZXing and Java 6

1,320 views
Skip to first unread message

Alejandro Gil

unread,
Jan 6, 2014, 7:57:18 PM1/6/14
to zx...@googlegroups.com
Hi,
 
I'm new using ZXing (and Java I may add) and I want to use Java 1.6.
 
Is it possible to compile JAVASE.JAR and CORE.JAR using Java version 1.6?
 
Thank you for your answer.
 
Regards,
AGH

Sean Owen

unread,
Jan 7, 2014, 4:30:55 AM1/7/14
to zx...@googlegroups.com
The answer is slightly complicated. All of the Java code is written for Java 7 right now, so you could not compile it with Java 6. It would not be too hard to change the parts that don't compile in 6 to do so, if you want to go that way.

core/ however will run in Java 6 since it works in Android, which is effectively the Java 6 API. For example, try-with-resources is not used since that would actually cause the code to refer to AutoCloseable, which is only in 7. javase/ however does use try-with-closeable; it's only going to run in 7, as-is.

I am still not sure if core/ works in the standard Java 6 VM. It won't unless you compile it for 6 since the major/minor bytecode version won't match. And I forget whether javac itself lets you cross-compile from 7 to 6. It works on Android since dex/aapt will consume Java 7 bytecode even though the API level is only 6.
Reply all
Reply to author
Forward
0 new messages