Upgrade to JDK 7 in Spring Tool Suite (STS) - java

I use STS, and would like to update one project only to Java 7. Its a project that I have exported from git, and uses the switch(String) statement. Can I change the JRE settings for this project alone to Java 7 in STS while keep the others running in Java 1.6? I am currently seeing the error -
Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are
permitted
Can someone please throw some light?

project > right click > java > compiler > compiler compliance level > 1.7

Related

Release 6 is not found in the system - Creating a Project

I have now a little experience in Java, so I wanted to take the next step to an IDE, so I installed the Eclipse IDE. (If it matters, I am using mac.)
But this does not seem to work right, as soon as I create a new class, the error occurs:
The project was not built due to "release 6 is not found in the
system". Fix the problem, then try refreshing this project and
building it since it may be inconsistent HelloWorld
I already tried to change some of the properties in the class or selecting different settings, right now I use the execution environment JRE: J2SE-1.5.
Thank you for taking your time!
Well it is basically telling you that you don't have the right version of Java JDK installed. THIS page seems to imply the current version of eclipse needs 1.8 - not the 1.6 you're talking about. I am unsure though how you could have specified one that isn't installed. Maybe you only have the JRE (java runtime environment). You will definitely need the JDK (java development kit) because that is what has the java compiler in it.
It's been a long time since I used eclipse but when you created the project you should have been prompted to specify the java version. Now try right clicking on the project and choose Build Path... Configure Build Path. On the Java Compiler tab (left side) you should be able to change the configured Java to whatever you have installed.
I got this error when the selected version under Preferences > Java > Compiler > Compiler compliance level was higher than the selected version under Preferences > Java > JREs > Installed JREs. There was a small (very small) warning at the top of the JREs page warning me that there was an incompatibility with the compiler compliance level.
The options for compiler compliance level includes all versions up to the version that Eclipse itself is using, even if you don't have a specific JDK with that version, so you can get warnings for JDK releases that you definitely don't have.
I updated the compiler compliance level to be the correct version for my project and that got rid of the problem.

Eclipse Does Not Recognize JRE 8 as Greater Than JRE 5

I have installed Java 8 on my machine and have started a project with it. However, when I use an #Override annotation, the code is underlined in red, and the error Syntax error, annotations are only available if source level is 1.5 or greater appears.
I have installed the released Eclipse Java Development Tools Patch with Java 8 support (for Kepler SR2), but this only adds support for new features in Java 8, and does not fix the bug with annotations.
Make sure your INSTALLED_JRE is pointing to jdk 1.8 in eclipse
Preference > java > installed_jre
Make sure java > compiler is set to 1.8 in eclipse
preference > java > compiler > compiler compliance level
If you are using maven, you can try right click the project name and run Maven/Update Project.
by default 1.4 version will set, so make sure set preference > java > compiler > compiler compliance level in eclipse IDE

How do I know the compiler version which the eclipse is using?

I am using JRE version 7 with my eclipse. How do I know the compiler version which the eclipse is using ?
goto
check for jdk
windows > preference > java > installed jre
check for eclipse's compiler compliance level
windows > preference > java > compiler
It can be different for each project. Right click on the project, and go to Properties/Java Compiler.
Choose Window/Preferences/Java/Compiler to see default configuration of your IDE.
Check the project properties as well to be sure you do not have per-project configuration differ from default.

Eclipse: Compiling A Plugin For Java 1.5: "Columns For Eclipse"

I decided to give Eclipse (Eclipse 3.7.2 ) a chance because of the plugin "Columns For Eclipse". The IDE I would like to migrate away from ( Visual Slickedit ) has spoiled me with sophisticated column editing features and this plugin has most of them, whereas the default column editing features in Eclipse are too basic for me.
I tried the plugin out at home and I really like it. However, the machine I use at work runs on Java 1.5 and the plugin requires Java 1.6.
I would like to try recompiling the plugin under Java 1.5, as my job uses WebLogic 9.2 which runs on Java 1.5. I don't want to risk compatibility issues by setting up my computer to run on Java 1.6
I have the source code, but it didn't come with directions on how to compile the plugin. It isn't structured in a Maven project.
I'm 100% new to Eclipse so I was wondering if someone could give me step by step instructions for compiling (and installing ) my own copy of the plugin under Java 1.5.
Alternately, is it possible to set up Eclipse 3.7.2 to run on Java 1.6 but always compile in Java 1.5?
Thanks much in advance.
Building and installing the plugin without an existing build script would be quite complicated. For your second option, you can setup the compiler compliance level for the entire IDE:
Or alternatively, you could set it up on a project-by-project bases (Right click project, Properties->Java Compiler).
Yes, it is possible to run Eclipse with Java 6, but use a Java 5 JDK as the default for compilation and runtime. You need to configure Eclipse: Window -> Preferences -> Java -> Installed JREs.
You can also use Java 6 as the development/runtime and set the compiler compliance level to 1.5 (same as 5), but that's a bit dangerous as it doesn't stop you using APIs only available in Java 6; it only enforces language syntax.

Can I use Java 7 with Eclipse 3.x?

I am trying to config my eclipse (Helios) use jdk 7 to compile my code. I didn't install jdk 7 on my Windows XP. But I include all of the jdk contents with my project. It seems the solution provided in this post doesn't work. Compile java code needs JDK. the JRE is enough for running the compiled code. I think we need a way to configure the JDK to be used not just JRE. I tested with a JDK 7 new feature, String in switch, I can compile it in my batch file compile system but cannot use eclipse to compile it.
any idea?
This is what I did to make Eclipse 3.x works with Java 7.
install Java 7 in another machine and then copy the JDK folder into my java application 3rdparty directory (so my machine still use Java 6);
download the Eclipse 3.7.1 from here: eclipse 3.7.1
configure Eclipse by following steps in this post (select 1.7 in Compiler compliance level under the Java Compiler entry);
At least I can use String in Switch now in Eclipse.
Good luck.
Compile java code needs JDK. the JRE is enough for running the
compiled code.
that is right
"But I include all of the jdk contents with my project"
Including those will not change eclipse's compiler behavior. Including files under project build path just makes those classes available for your application development/run-time (or as good as setting CLASSPATH)
Do these :
1 - Install required version of JDK
2 - Choose following menu - Window > Preferences > Java > Compiler - and you will see a drop down to choose the version you want to use.
3 - Read this and this as well.
Good luck for being DBA after 5 yrs. Please consider working on your English as well (no offense please)

Categories

Resources