Is JDK 1.6 compatible with JDK 1.5?

I have a compatible problem, my project is being developed in JDK 1.6, but when I need to publish it to the host domain, there is a problem when the host domain uses JDK 1.5, how do I make the project compatible with JDK 1.5? thank you in advance

+6
java compatibility backwards-compatibility
Jun 16 2018-10-06T00:
source share
2 answers

You need to set the -target attribute. Also see javac /? .

 javac -target 1.5 [...] 

Also see this example in the javac documentation.




Update : According to the comments that you use Eclipse, you can simply change the compiler compliance level for each project. Rightclick Project> Properties> Java Compiler> Compiler Compliance Level> 1.5. See screenshot .

alt text

You can download JDK 1.5 from the Sun Archive .

+11
Jun 16 '10 at 1:53 on
source share

You must set the compliance level in your compiler / IDE to 1.5 to flag any incompatibilities (via compiler warnings). Then you can fix everything you need to do to make your code 1.5 compatible.

In Eclipse, for example, you will go to Preferences / Java / Compiler and set the compliance level to 1.5. This is likely similar to other IDEs.

+3
Jun 16 '10 at 1:53 on
source share



All Articles