Can we use different JDK's for Spring tool Suite based on eclipse and eclipse luna - eclipse

I have some projects in my eclipse Luna that are based on Java 1.6 and I am trying to learn the latest spring boot which uses Java 1.8 , I am learning spring boot on spring tool suite which is based out of eclipse ,I tried installing Java 1.8 in my system and I have successful install both 1.6 and 1.8 Java in my system but when I try to open Spring tool suite it says JDK version should be 1.8 or higher I know I have the classpath set as 1.6 but is there anyway we can set the classpath 1.6 for eclipse Luna and Java 1.8 classpath for spring tool suite because I constantly change over projects as because Java 1.6 is my production environment in Java 1.8 is something like a test where I am trying to learn spring tool suite.
Is there any way we can achieve this without having to change the classpath everytime I Switch between spring tool Suite and eclipse Luna

The first thing to understand is that Eclipse itself requires a JRE to run (preferably a JDK), and that JRE can be different than the one that your projects in Eclipse are configured to use - they are intentionally separate.
To specify the JRE that Eclipse itself runs in, you should specify it in eclipse.ini. Read that page carefully, the format is very particular. Once you've done that, your system classpath or JAVA_HOME or PATH will not matter, Eclipse prefers its own ini settings.
With that done, the default JRE/JDK used for your projects in Eclipse will be the same as the one Eclipse itself is running in. But that's only the default, you can add more JRE/JDKs and configure individual projects to use them.
The point is, each instance of Eclipse can be configured to run in a particular JRE/JDK you have on your system (although there's really no reason not to use the latest for running all Eclipse instances), and then within each Eclipse instance, each project can be configured to use a specific JRE/JDK (which may or may not be the same one that that Eclipse instance is running in).
For example, you should probably configure both Eclipse Luna and STS to use the JDK 8 you have, via their .ini files. Then in Luna you can add a JRE config for JDK 1.6 on your system and set projects to use that one. The projects don't have to use the same JRE/JDK that Eclipse itself is running in.

Related

Eclipse RCP - Wrong plugin version is refered

I have eclipse rcp 4 application, which i migrating from mars to oxygen. It is a feature based application. All the required plugins are added to feature tab but some plugins like org.apache.batik.css, org.apache.batik.util and org.apache.batik.util.gui causing dependency issues. plugin tab by default taking 1.8 version of these plugins. But it seems that it has refer 1.7 version because if select only 1.7 from run configuration window application runs fine. Is there any way to make feature tab to select only 1.7 version instead of 1.8 permanently.? I tried to remove 1.8 version from eclipse plugin folder and it worked. But is there any better solution other than manually altering physical files?

MyEclipse doesnt accept JDK for creating Runtime

I am trying to create a JBoss Runtime in Eclipse. I have added 2 JRE entries in my Eclipse - one for JDK1.7 and another for 1.8.
Still Eclipse wont identify my 1.7 entry. See screenshots attached.
P.S: I got my JDK 1.7 by extracting the MSI/Exe setup file using 7 zip. I have done regular installation of Java 1.8 and My Java_Home is set to 1.8 in the PC. I don't want to modify it to point to lower version as it will impact other projects.
Your JRE definition won't be recognized as valid for the JBoss runtime if it is not a JDK. Your extraction of the JDK may have resulted in a JRE instead. Why not just run the JDK installer and change the installation folder to something other than your Program Files folder; it won't switch your system to Java 1.7 that way (I just tried this myself to check). Then define a new JRE to point to the newly installed JDK 1.7 and you'll be able to use that for the JBoss runtime.

java 7/8 for Eclipse luna on Mavericks

I'd like to upgrade my eclipse from Kepler to Luna on my OSX Mavericks. I also have some web apps that do not seem to work with Java upgraded beyond the 1.6.0_65 level. Is there a method for installing Java 8 for use with Eclipse Luna, but still retain the 1.6.0_65 version as a default.
Yes, you can have multiple JVMs installed. To set the default JVM to 1.6, set JAVA_HOME to /Library/Java/JavaVirtualMachines/jdk1.6.0_65.jdk/Contents/Home.
To set Eclipse's JVM, follow VonC's instructions for editing eclipse.ini.
However, Eclipse's JVM1 is not tied to the JVM which Eclipse uses when running your Java applications. Those are configured in Eclipse Preferences, under Installed JREs.
1 Eclipse is, of course, a Java application itself, so it runs in a JVM.

headless AJDT build fails when upgrading java from 1.6 to 1.7

strong texti have a very simple eclipse 3.8-based rcp application with an .aj file. i also have AJDT 2.2.1 installed, and have the following four entries in my build.properties:
javacSource=1.6
javacTarget=1.6
compilerAdapter=org.eclipse.ajdt.core.ant.AJDT_AjcCompilerAdapter
sourceFileExtensions=*.java, *.aj
i am using a headless build approach via Ant, and it has been working like a charm, AJDT and all, while using java 1.6. but once i upgraded from java 1.6 to 1.7, and changed the two aforementioned build.properties entries' -- javacSource and javacTarget -- values from 1.6 to 1.7, i got a boat-load of build errors, all with the following suffix:
... are only available if source level is 1.5 or greater
setting build.properties' javacSource back to 1.6, while leaving javacTarget at 1.7 works. or if i were to comment out the two AJDT-specific entries from my build.properties, while leaving javacSource and javacTarget values at 1.7. the build completes just fine as well. so my guess is that AJDT compiler is somehow the culprit. the question is why and what can be done to resolve it.
thank you for your time!!!
It sounds like one of two things:
Your AJDT installed does not have an AspectJ in it that is compatible with Java 1.7. What AspectJ version are you building with? Note that this aspectj version may be different from the one in your target platform.
You are not correctly specifying the Java source/target version in a way that AspectJ can recognize. How are you specifying the Java source/target version?

Ant ran from MyEclipse not using the "default" JRE

I am working as a contractor, and they are using MyEclipse 10.0 with Ant to do builds. Its been a LONG time since I used Ant as the build tool, as I have primarily been on Maven for some time.
Their source are broken into multiple projects, and each links back to a common project that has a commone build.xml that is imported by each project's build.xml. The ant script is used to WAR the app and do deployments both locally and on their Test environment using WebLogic's java-based deployment tools. They are using WebLogic 9.2, which, from what I read, has issues with JDK 1.6 and higher. I have set the 1.5 JDK/JRE as the default inside MyEclipse in Preferences->Installed JREs.
For all the projects, when I launch the Ant target from within Eclipse it runs under the 1.5 JDK/JRE I set as the default. But for this one project it seems to insist on running under the 1.6 JDK that ships as part of MyEclipse 10. If I right-click on the Ant build in the Ant view/tab and look at the properties for the Run Configuration (right click, Run As->External Tool Configuration...), the JRE selected shows the 1.5 JDK/JRE. But alas, when I run it it STILL is running under the 1.6 JDK.
Any thoughts?
Search your Ant files for the string fork. It might be that one of the Ant tasks itself starts a new VM.
It turns out, even though Eclipse was reporing the JDK set to 1.5, it wasn't. I went into Run As->External Tools..., set it to 1.6, saved, then set it back to 1.5...poof! now it works.