Java Compatibility

I'm somewhat new to Java so I downloaded NetBeans and JDK 1.6. I wrote a small program and everything works fine on my system. But, it will not run on systems that have 1.5 or 1.4 installed, including Windows, Linux, or Mac.

It was my understanding that Java was cross-platform. So, to get a true cross-platform program to run on all systems, what compile options do you need to set. I believe that Mac only supports Java up to 1.5, maybe not even that high. So how do you get a program compiled on 1.6 to run on 1.5 or 1.4?

I set the target attribute to version 1.4 and set the classpath flag to my 1.4 sdk, but it was throwing a bunch of errors due to Swing. Is what I'm wanting to do even possible? Thank you.

[733 byte] By [JCooka] at [2007-11-27 2:02:03]
# 1

If you want to be able to run your app on the most pc's you will have to compile it at 1.4. This means your code has to be java 1.4 compatible, you can not use fancy things from java 1.6 and compile that in 1.4, it can not be done.

So this means yes you can get it to work on 1.4 and 1.5 and 1.6 but then you just have to program and compile your code to meet the requierments for 1.4.

kimatrixa at 2007-7-12 1:42:56 > top of Java-index,Java Essentials,New To Java...
# 2
> It was my understanding that Java was cross-platform.Java IS cross-platform, but it's not forward compatible. There's a difference.
SoulTech2012a at 2007-7-12 1:42:56 > top of Java-index,Java Essentials,New To Java...