java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/sonarsource/scanner/ant/SonarQubeTask, offset=6

SonarQube Verison: 7.6
GIT version: 1.7
JacocoPlugin: 1.0.1
sonar-scanner-cli-4.0.0.1744.jar
sonarqube-ant-task-2.6.0.1426.jar

i have configured sonar in our ant project build.xml
when i run ant sonar in our build machine…its giving below error…but on another system its working…i want to run this in our build system…so that everytime it runs ant sonar…results are displayed for every build.

My build machine is setup with java/jre 1.7
but when running ant sonar -v…it shows java/jre 1.8
later i updated the PATH and set to 1.7…
but still issue exists…

BUILD FAILED
/root_outside/git/liger-solserver-service/ilg-sol-common/build.xml:29: java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/sonarsource/scanner/ant/SonarQubeTask, offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:331)
at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1136)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1307)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1362)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1323)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1076)
at java.lang.ClassLoader.loadClass(ClassLoader.java:741)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:309)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:579)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:237)
at org.apache.tools.ant.taskdefs.Antlib.execute(Antlib.java:180)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:428)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:277)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Hi,

Welcome to the community. The version of SonarQube you’re running is at least 6 years old. No one will help you with it.

The current version of SonarQube is 8.0, and the current LTS is 7.9.1. Your upgrade path is: 3.x -> 3.7.4 -> 4.5.7 -> 5.6.7 -> 6.7.7 -> 7.9.1 -> 8.0.

 
Good luck,
Ann

Hi Ann

The version of sonarqube we are using

Community EditionVersion 7.6 (build 21501)

how to change the javac version in linux…
its showing 1.8
but our build machine using 1.7

Hello,

You need to upgrade your JDK on the build machine. Depending on the linux distribution, the procedure will be specific. One of the available JDK is openJDK, that you can get with the adopteOpenJDK initiative. Here is the generic installation documentation. If you are using debian or ubuntu, there are package available.