Is there any way I can run class files (i.e. with main as the entry point) on JDK 6 that were compiled with Java 5?
+11
A:
Yes. Old java code can be executed on newer JVMs, but not the other way around.
You'll be fine.
MBCook
2009-05-18 00:09:46
+1
A:
Sure, that should work with no trouble at all. Why, are you having a problem? Be more specific.
jodonnell
2009-05-18 00:10:10
I am not having problems doing it; admittedly I have not tried it yet. I wanted to make sure this is possible before I start heading down that road. I just remember having problems running Java 5 code on different versions, I don't remember if it was 6; I guess I was trying to run 5 on 1.4.
Alex Beardsley
2009-05-18 00:14:14
if you want to allow your code to run on older versions of java you can give javac the -target parameter. See http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html
Catchwa
2009-05-18 02:01:45
Problem is, that won't work if you're using any of the newer language features.
Michael Borgwardt
2009-06-05 23:34:13