user16168
user16168

Reputation: 655

Java illegal start of type in correct project

I have a Java application which I cannot launch

All error message of the type:

illegal start of type
HashMap<String, Double> simScoreTable = new HashMap<>();
                                                    ^

illegal start of type
HashMap<String, Double> simScoreTable = new HashMap<>();
                                                    ^

The project requirements are Jdk 1.7 or higher.

My installed version is

java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode)

It looks like I have some version problem. I would appreciate if you could show me the problem.

javac 1.6.0_27

Upvotes: 0

Views: 1576

Answers (1)

fge
fge

Reputation: 121810

You seem to be using a 1.6 JDK but a 1.7 JRE. Since you are using ubuntu, try and see what this command gives:

dpkg --list|grep openjdk

If my reasoning is correct, you will have openjdk-6-jdk and openjdk-7-jre. If this is the case, try and:

sudo apt-get install openjdk-7-jdk

Normally, JDK 7 has a higher priority than JDK 6 (see update-alternatives); so after install, you should have the correct compiler version. Check again with javac -version.

Upvotes: 1

Related Questions