0

I am working on a Java Web Application in Eclipse. When checking my code with PMD, I get the following error:

An internal error occurred during: "ReviewCode".
com/infy/jcart/beans/Registration : Unsupported major.minor version 52.0

I have checked certain links on StackOverflow which talk about this error:

Peculiar Eclipse java.lang.UnsupportedClassVersionError, Unsupported major.minor version 52.0

PMD Eclipse Plugin error: An internal error occurred during: "ReviewCode"

So, I have come to know that this error happens because of some incompatible JRE/JDK versions. I have set the compiler version to 1.8 properly and added JRE 1.8 in Build Path also. But still the error persists while checking PMD.

Any help is appreciated.

Community
  • 1
  • 1
A_J
  • 977
  • 4
  • 16
  • 44

2 Answers2

1

It's likely that the JRE you are using to run Eclipse is not 1.8, but that the PMD version you are running has been compiled using 1.8. Check the JAVA_HOME variable and make sure it points to a 1.8 JRE.

Also, you can go to Help -> About Eclipse -> Installation Details -> Configuration.

You should have a line like this:

-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/lib/server/libjvm.dylib

(I'm on a mac, yours will point to a windows path if you are on windows.) Make sure that this is pointing to a 1.8 JRE as well.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
  • I found out that we should give -vm comments to make it point to the specific jre as you mentioned in your answer. http://stackoverflow.com/questions/1410511/eclipse-jvm-configuration. Thanks! – A_J Sep 21 '15 at 11:53
1

Yes - major.minor version 52.0 is Java 8 (see https://en.wikipedia.org/wiki/Java_class_file).

The class com.infy.jcart.beans.Registration seems to have been compiled with java8 - as you described.

Then it depends on which version of PMD/PMD-Eclipse-Plugin you are using. PMD supports java8 beginning with version 5.1.2 (initial support was with 5.1.0, but class file loading only works with 5.1.2) - and PMD Eclipse Plugin 4.0.4.v20140909-1748.

I'd suggest to try updating the PMD Eclipse Plugin to the latest version available from the update site https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/ .

adangel
  • 1,816
  • 14
  • 17
  • Thanks for interest in my question. But I think the PMD plug-in is the latest version. Since I already updated that. Problem was the jre version of Eclipse which I changed in eclipse.ini file. It worked fine after that. – A_J Sep 21 '15 at 11:53