I updated my system to run off of Java 9 primarily and my spring projects are also supporting Java 9. I have an issue however with my Spring Tool Suite (Eclipse 4.7.2) where the program is saying that my code is incompatible with my source level compatibility settings and must be JRE 1.5 and up (parameterized types for example).
In my Project properties my Compiler Compliance Level and Source Compatibility is set to '9'.
In my Window->Preferences, I have set my checked installed JRE to the location of my Java jdk-9.0.1 folder.
Here is my sts.ini (eclipse.ini) file:
STS.ini
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.551.v20171108-1834
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
--add-modules=ALL-SYSTEM
-Xms40m
-Dosgi.module.lock.timeout=10
-Xverify:none
-Dorg.eclipse.swt.browser.IEVersion=10001
-Xmx768m
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk-9.0.1\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
--add-modules=ALL-SYSTEM
Any help solving this problem would be greatly appreciated.
The JVM that you specify in your STS.ini is not related in any way to the projects and their compiler levels in your workspace. You can easily run STS on top of a JDK8 and still have projects in your workspace that compile for Java9.
In order to compile projects against a certain level, you have to have a related JDK configured in your preferences. Sounds like that you said that you did that already. There is also a sub-section called "Execution Environment", where you can specify which JDK on your machine should be used for which Java language level. Make sure that you have the right JDKs selected there.
Your STS.ini looks broken: there should be only a single -vmargs section; -vm and --launcher.appendVmargs must be above -vmargs:
Remove the last three lines (which are duplicated lines) and move --launcher.appendVmargs, -vm and the following line above -vmargs:
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.551.v20171108-1834
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk-9.0.1\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
--add-modules=ALL-SYSTEM
-Xms40m
-Dosgi.module.lock.timeout=10
-Xverify:none
-Dorg.eclipse.swt.browser.IEVersion=10001
-Xmx768m
For those who come across the same issue in the future: I solved the issue, but neither of the previously posted corrected the issue (although they were helpful). I followed the steps here and added the '-clean' line to my sts.ini file and restarted eclipse.
Related
I have eclipse can't start correctly, i have tried two ways:
set environment variables about java, and running and compiling in windows cmd is fine. i have no admin rights and system path have wrong java path but i can't change it. so the eclipse will crash.
use -vm option in eclipse.ini without java_home setting, have following error:
java.lang.RuntimeException: Application "org.eclipse.ui.ide.workbench" could not be found in the registry.
my eclipse.ini:
`-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
C:\software\java\jdk_1.7.0_89\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
`
Thanks everyone!
Eclipse Neon (and Eclipse Oxygen) both require Java 8 to run, you appear to be running Java 7. You will have to install Java 8 and specify its location in the eclipse.ini.
I'm running windows 7. When I double click on STS.exe, then this is the error message I get.
I uninstalled all JRE/JDKs, downloaded the latest one (v8 u131), and manually added the -vm line below.
STS.ini
-startup
plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.401.v20161122-1740
-product
org.springsource.sts.ide
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jre1.8.0_131\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms40m
-Dosgi.module.lock.timeout=10
-Xverify:none
-Dorg.eclipse.swt.browser.IEVersion=10001
-Xmx768m
It turns out that if you go to https://spring.io/tools/sts it will give you the 32bit version of eclipse by default.
I needed to go to https://spring.io/tools/sts/all and specifically find the 64bit version of eclipse (STS) to match my JDK which is 64bit.
Eclipse error detection/reporting could easily be improved to save a lot of unnecesary grief. And the Spring website could be improved to offer both 64bit and 32 bit links from the download page so that the decision/distinction is obvious.
I've checked the other relative common posts to mine but they a slight difference that didn't give me the solution I needed:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
C:\Program Files (x86)\Java\jdk1.80_25\jre\bin\javaw.exe
I have checked over and over in that path, and javaw.exe is definitely there. Any ideas what to do, I had a exit-13 problem before I followed a step to add
"-vm "path to javaw.exe" in my eclipse.ini but I don't know what to do now.
My eclipse.ini file:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files (x86)\Java\jdk1.8.0_25\jre\bin\javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms40m
-Xmx512m
Got it to work, uninstalled all my Java's, reinstalled jdk (x86) in my case, installed newest jre (x64) to delete obsolete ones from the jdk and it worked. THanks everyone
-vm
C:\Program Files (x86)\Java\jdk1.8.0_25\jre\javaw.exe
should be something like
-vm
C:/Program Files (x86)/Java/jdk1.8.0_25/
or even better:
-vm
C:/Program Files (x86)/Java/jre1.8.0_25/bin/server/jvm.dll
On a side note, download the 64bit version if you can
The potential problem is you are using 64 bit Eclipse but 32 bit java. Either use 32 bit eclipse or install 64 bit java and re-try. It all started with Java 7!
Just copy this file:
C:/Program Files/Java/jre(5,6,7...whatever version)/bin/javaw.exe
to the Eclipse folder (directory where the eclipse.exe is located)
Please note: Only tested for Windows
Alternatively, right click on Eclipse icon, select Properties and edit Target field.
There will be a large string, edit it to point to correct javaw.exe path:
-vm "c:/Program Files/Java/jdk1.8.0_65/bin/javaw.exe"
I downloaded the latest Eclipse on Windows 7. When I click the eclipse icon it throws the following exception:
I have already installed JRE and JDK.
UPDATE: Eclipse.ini contents:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m
-vm C:\Program Files (x86)\Java\jre7\bin
According to the Eclipse documentation, you may need to specify the VM before the VM args, and the path should not be on the same line as the -vm switch:
The -vm option and its value (the path) must be on separate lines.
The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
Source: Eclipse Wiki
For example:
-vm
C:\Java\JDK\1.6\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m
You also might need to surround your path with some quotes, since it contains spaces. I always install things like Eclipse and Java in root directories with no spaces, not under Program Files, to avoid this problem.
Reference the location of your JRE path in the eclipse configuration file, eclipse.ini.
Note that you only need a JRE to launch Eclipse, but once Eclipse is launched, you should register a JDK for your projects. This is done via
Preferences-> Java -> Installed JREs
Same happened with me on win7. I had 2 folders for 'program files'
Program files
Program Files(x86)
java folder was present on both. For environment variables, I have given the path of java from program files(x86)...\jre6\bin. Then I had downloaded new java 7 version update. Then had tried to open eclipse, it worked and i had not made any changes to eclipse.ini file. My eclipse.ini didnt have any reference to the -vm argument.
I have the same of problem because I was have both the java 1.7 and the java 1.8 and I solved the problem By :
for windows :
first :
open your CMD and write java -version
the result is the current version of java on your pc for exampe the result is 1.8 so
second
open the eclipse.ini and if the path was not the path of current version java (that shown in result of CMD) edit the path to correct path of your java (the version shown in result )
like this :
before I change the path was :
-vm
C:\Program Files\Java\jdk1.7.0_45\jre\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
after I check of my version of java using CMD the result is : java 1.8
so I change the path and version like this :
-vm
C:\Program Files\Java\jdk1.8.0_45\jre\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
Nice Day :)
I am working on a fairly large project and have recently bumped into the good old friend of mine from the 90's, typing lag.
My setup is MacBook Pro 2.2 GHz i7 8GB with SSD drive and it hasn't had any serious performance issues so far.
I have increased the memory allocations to -Xmx1024m and -XX:MaxPermSize=512m. There is no heavy use of plugins involved. Also, this only happens on .java files in the default editor.
What could be the problem?
EDIT:
I found the problem. I noticed that the problem occurred only when editing large java files. In my case the class had 1800 rows.
It's weird though, since I am not facing the same problem with the same eclipse setup on Ubuntu. It seems like Eclipse on Mac just can't handle java files that big I was editing.
Any suggestions?
EDIT2:
I am using the Eclipse Indigo for Java EE with the latest updates (3.7.1.X)
Installed plugins:
m2eclipse
MercurialEclipse aka HGE (1.9.1 from the official eclipse update site)
Subclipse (installed, but not used in the workspace where the typing lag occurs)
ADT (installed, but not used in this project)
All plugins are installed via Eclipse marketplace and are updated to the latest release unless stated otherwise.
Try altering the settings in your eclipse.ini file. This contain the settings for the JVM and can help reduce memory issues like this.
Example eclipse.ini:
-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
../../../../program files/Java/jdk1.6.0_17/jre/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins
Detailed in this question and this question.
Jivings was right about the root of the problem being in the eclipse.ini file.
I am not sure what I have actually changed in the eclipse.ini after messing around with the it, since the TimeMachine does not seem to be able to save a backup of the .ini file inside the Eclipse application package (Eclipse/Contents/MacOS/eclipse.ini).
I actually lowered the MaxPermSize and other memory values which made Eclipse run smoother. If anyone else is encountering the same problem, I suggest you try similar values and see if that works. If it doesn't, I also read that you can start eclipse once with the -clean argument, which cleans up some installation and usage history among other things. I did not do that, but it's worth a try.
The following is my current configuration, and it works pretty well:
-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts