I am having a problem with compiled .jar projects in netbeans. I recently upgraded to java 1.8 and netbeans 8.0. After updating every project I compile and put onto my server running java 1.7.0_55 I get the "Unsupported major.minor version 52.0" issue. I know this is due to incompatible java versions. I have tried changing the jdk used for building everywhere I can find it. I have tried building with 1.7.0_55 and 1.7.0_07 and still get this issue. Does anyone know what I am missing? Each time I have changed the build settings I make sure to recompile the project. It is not possible to update the version of java on the server just yet.
-
You need to make sure that every project is compile to the same level. That is, either using the same Java Version or compatibility level. You will also need to ensure that any external libraries also support your targeted Java version... – MadProgrammer Apr 22 '14 at 00:21
-
I have made sure every project should be compiling with 1.7.0_55 and they are using the same libraries they were using before I upgraded to 1.8 when everything worked fine. The server uses java 1.7.0_51, which is totally compatible with 1.7.0_55. – ferrago Apr 22 '14 at 00:27
-
Fixed it, fyi Clean and Build is actually useful. – ferrago Apr 22 '14 at 00:31
-
http://stackoverflow.com/questions/32199584/compiling-any-javafx-project-in-netbeans-returns-unsupported-major-minor-version the solution is change the default jdk to 1.8 – Enrique San Martín Sep 30 '15 at 15:24
-
Possible duplicate of [Unsupported major.minor version 52.0](http://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0) – Autar Oct 13 '15 at 13:26
-
Why did you upgrade to a 7 years old Netbeans 8.0 and not the latest version? – Boris Jun 08 '21 at 17:18
2 Answers
If you are using Maven, you can set the JDK version of each module by placing a file called nb-configuration.xml
beside your pom.xml
with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<netbeans.hint.jdkPlatform>JDK_1.7</netbeans.hint.jdkPlatform>
</properties>
</project-shared-configuration>
The "JDK_1.7" Java platform must be configured in Tools -> Java Platforms -> Add Platform...

- 546
- 8
- 13
Does anyone know what I am missing?
Well the one thing you were missing is that everything needs to be built for Java 1.7. It is not sufficient to just configure the IDE to use JDK 1.7. You have to make the IDE do the rebuild ... for everything that was previously built with Java 1.8 as the target.
Clean and rebuild all relevant projects after changing the project's Java target platform.
I also recommend that you start using Maven / Gradle / whatever to specify your build configs. This allows you to specify in the build configs what the target platform should be. If you do this, you are less likely to be burned with bad builds when you upgrade your IDE and/or development machine's default Java install.

- 698,415
- 94
- 811
- 1,216