GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 290 forks source link

could not start goclipse because java version is 0 #256

Open haoquanwang opened 6 years ago

haoquanwang commented 6 years ago

goclipse version: 0.16.1 Eclipse Version: Oxygen.1a Release (4.7.1a) Build id: 20171005-1200 java version "9.0.1" Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

When there is JDK 9 installed, starting Eclipse would give an error message "could not start goclipse because java version is 0"

I also installed JRE 9, problem remains the same.

Work around would be: installing JDK 8 along side java 9, then either:

1: Add -vm/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java to /Applications/Eclipse.app/Contents/Info.plist

Or:

2: change -vm option in /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini from

-vm /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin -vmargs

to

-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin -vmargs

I suppose substitute "jdk1.8.0_152.jdk" to any subversion of java 1.8 on your mac OS would work but I haven't tried. jdk1.8.0_152 is the latest as of 23rd November 2017.

I notice there is jre in /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/ but there is no jre in /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home even I have installed jre 9.

haoquanwang commented 6 years ago

Forgot to mention the OS is:

System Version: macOS 10.13.1 (17B48) Kernel Version: Darwin 17.2.0

JDK and JRE were downloaded from Oracle.

bruno-medeiros commented 6 years ago

Note that the error message is not true, Goclipse does start successfully despite what the message says, so you can just keep using it. As a workaround, locate the plugins directory in the Eclipse installation, and delete the com.googlecode.goclipse.jvmcheck_1.0.0.v201607061938.jar file, this will prevent the error message from being shown.

markus-wa commented 6 years ago

As a workaround, locate the plugins directory in the Eclipse installation, and delete the com.googlecode.goclipse.jvmcheck_1.0.0.v201607061938.jar file, this will prevent the error message from being shown.

I can't find this jar. I'm on Windows with Eclipse Oxygen 4.7.2 and JDK 9.0.1 and installed GoClipse via marketplace.

GoClipse appears to work anyway like you said, but it's still slightly annoying.

bdobby commented 6 years ago

I have same setup as @markus-wa . The file is there on my system. Note the file is com.googlecode... not com.google...

myrlyn commented 6 years ago

This appears to be due to the change in versioning scheme by JDK. Previous version scheme was (essentially) 1.MAJOR.MINOR-release New versioning schems is MAJOR.MINOR.RELEASE So "public static int getJavaVersion()" only parses the second number in the version string. Since the JDK 9 version is 9.0.4, it parses '0'. The method needs to parse the first entry, and return that if it is higher than '1'. I'll try to submit a merge request with this later.