Ubuntu – JVM problem while running eclipse

eclipsejava

I have installed Java 9 JDK on my Ubuntu. Now I need to install Eclipse. I have downloaded and extracted Eclipse Mars to /opt folder. When I started eclipse from console I got error:

gedas@gedas-Latitude-E5450:/opt$ cd eclipse
g@g-Latitude-E5450:/opt/eclipse$ ./eclipse 
Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
g@g-Latitude-E5450:/opt/eclipse$ 

And message box:

JVM terminated. Exit code=1
/usr/bin/java
-Dosgi.requiredJavaVersion=1.7
-XX:MaxPermSize=256m
-Xms256m
-Xmx1024m
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /opt/eclipse//plugins/org.eclipse.platform_4.5.2.v20160212-1500/splash.bmp
-launcher /opt/eclipse/eclipse
-name Eclipse
--launcher.library /opt/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.300.v20150602-1417/eclipse_1612.so
-startup /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.appendVmargs
-exitdata 121800e
-product org.eclipse.epp.package.cpp.product
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XX:MaxPermSize=256m
-Xms256m
-Xmx1024m
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar 

java -version returns

java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+111)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+111, mixed mode)

How to fix this problem?

Best Answer

so solution is you have to change default jdk by following command

sudo update-alternatives --config java

And select different entry for jdk path eg:- 1 or 2 or 3 any and enter you have to change entry from default to some different jdk

This will work 100%

Related Question