-1

I need to compile an old project using JDK 1.5, but when I try to build it in InntelliJ it tells me:

Error:java: Target option 1.5 is no longer supported. Use 1.6 or later.
Error:java: Source option 5 is no longer supported. Use 6 or later.

I cannot use another IDE and I don't know how the project is building since I haven't worked in its development until now. Is there any way I can trick IntelliJ into letting me do this?

David Antelo
  • 503
  • 6
  • 19
  • 1
    Do not use java 5 for the ide, use it only for the specific project – Jens Jan 17 '20 at 08:00
  • Can you explain how to do that? I have already selected JDK 1.5 in my module settings as my project SDK and my Module SDK – David Antelo Jan 17 '20 at 08:01
  • "I cannot use another IDE" .. why not? – Stultuske Jan 17 '20 at 08:02
  • Maybe [this](https://mkyong.com/intellij/how-to-change-the-intellij-idea-jdk-version/) helps – Jens Jan 17 '20 at 08:02
  • This is a really old project, the people who started it no longer work here so nobody knows how it works. I have been told that other people have tried to use Eclipse and they haven't been able to configure it properly – David Antelo Jan 17 '20 at 08:03
  • Jens, that's already what I did, so no luck there – David Antelo Jan 17 '20 at 08:04
  • Is there a specific reason, why you have to use JDK 1.5 for this? Java should be able to be backwards compatible and older java code still for JDK 1.1 still can be compiled in JDK 1.8 or later. See: https://stackoverflow.com/questions/10895969/can-newer-jre-versions-run-java-programs-compiled-with-older-jdk-versions or here https://www.oracle.com/technetwork/java/javase/compatibility-137541.html#incompatibilities – Alexander Kaschta Jan 17 '20 at 08:04
  • Yeah, we deployed the application yesterday in the old Tomcat we are using and it doesn't work. We will change that Tomcat eventually but for the moment we have to deal with this – David Antelo Jan 17 '20 at 08:05
  • Have you tried just using Java 6? I worked on migrating multiple projects from Java <= 5 to Java >= 6 and every one of them just worked (migrating was mostly making sure everything worked and starting to use the newer features). – Nicktar Jan 17 '20 at 08:08
  • Yep, tried that but when you try to load a page while running the project with jdk 1.5 it gives an exception – David Antelo Jan 17 '20 at 08:09

1 Answers1

0

Ok, here's what I ended up doing: I set my project SDK and Module SDK to 1.6, but the project language level to 5. I configured my path to use Java 5, and confirmed this with java -version. Then, run my Tomcat, and it worked perfectly

David Antelo
  • 503
  • 6
  • 19