Compilation errors appear when building a feature patch - eclipse

I have a plugin which is compiled with JDK 1.5. If I change the compiler to JDK 1.6, I will get some compilation errors. So, I set the Java >Compiler preference to JDK 1.5.
Now I need to create a feature patch with that plugin specified in the feature patch. The feature patch gets created without errors. But when I export the feature patch project as a deployable feature, I get the same compilation errors above; like the IDE reverted to JDK 1.6. How do I force the build here to use JDK 1.5?
THANK YOU!

I'm not quite sure, but try this out:
Windows -> preferences -> Java -> Compiler -> compiler compliance -> 1.5
Windows -> preferences -> Java -> Installed JRE -> set up an 1.5 (download and install one, if there is only 1.6)

Related

This server requires an execution environment of JavaSE-1.8, but no valid JRE was found. Caution is advised

I use Eclipse 4.9 twice. one with jdk8 and one with openJDK11.
With both I want to integrate Wildfly 14 Runtime via "Window -> Preferences -> Server -> Runtime Environment".
The following error occurs when I select "OpenJDK-11.0.2" under Alternate JRE:
This server requires an execution environment of JavaSE-1.8, but no valid JRE was found. Caution is advised.
Thank you in advance for your views and possibly detailed solutions :)
sorry for my bad English.
To resolve it, go to
Window -> Preference -> Java -> Compiler
And change the value of Compiler compliance level to 1.8
It work for me.
Install an OpenJdk 11 JRE and rather select that as the execution environment.
That is Window -> Preference -> Java -> Installed JRE's
Although chances are you've already got that one installed so just select it from the execution environment.
Unless there's a good reason why you're wanting to use an alternate JRE.

Getting "Project facet Java version 1.8 is not supported." in Eclipse Luna

I am using up-to-date Eclipse Luna which should be ready for Java 8. However when I choose to create a new server with Tomcat 7 and click Next, in the Add and Remove screen I can't move my project because "Project facet Java version 1.8 is not supported." What is the problem and how can I fix this?
I solved the problem. Go to Project Properties -> Project Facets -> Runtime -> New -> Add a tomcat server and in JRE select JRE1.8.0_XX.
Did the work for me
In eclipse you can change the java version from your tomcat, see picture:
That is because you just changed your JRE location in the workspace property, which TOMCAT relies on.
Please reset your tomcat property accordingly again:
windows -> preference -> server -> Runtime Environments. To the right of Runtime Environments, you should see the servers. Remove Tomcat 8.0 and add Tomcat v9.0. Rebuild project.
You can remove and create it again, or just update it.
It is because Java version in your Project Facet is 1.8 make it 1.7.
Go to Project Properties -> Project Facets
and on right side checkboxes, select java checkbox(It might be already selected) and select the version as 1.7 from dropdown.
Window Menu -> Preferences
On the left, expand the Server and click Runtime Environments
Edit Server Runtime Environment. Choose JDK 1.8
Dont forget rebuild your project.
Actually I just wanted to add to the knowledge here. I often run into this problem. The thing that solves it for me is to actually change the Compiler compliance level.
Do this :
Right click on project -> Properties
Click on Java Compiler Tab
UNCHECK Enable Project Specific Settings, then click on the configure workspace settings... link and make sure your compiler compliance level is set to the preferred java version your runtime cannot support.
Once done, rebuild your project this may clear the problem.
This might be a problem with the jdk as well. I changed my jdk version from jdk1.8.0_65 to jdk1.8.0_25. IDE version that I have is Version: Luna Service Release 2 (4.4.2).

GGTS 3.6 Groovy:Internal groovy compiler error

I have a grails project, recently nothing compiles.
in eclipse on the Problems tab I see 100 out of 300 problems, most of them are Groovy:Internal groovy compiler error. every class has a red X on it, if I add an empty line in the file and save it the error would go away but not for long.
I had tried Build / Clean (both eclipse's and grails') / Refresh Dependencies / Compile in any possible combination. The run-app command works from eclipse with no issues. but eclipse is going crazy because I have so many errors. The only way I could make the errors go away is to disable eclipse's Build Automatically option and clean (without allowing it to build after)
Does anyone has an Idea ?
Current GGTS settings
Windows -> Preferences -> Java -> Installed JREs == jdk1.8.0_11
Windows -> Preferences -> Groovy -> Compiler == 2.3.3
Windows -> Preferences -> Groovy -> Grails == Grails 2.4.2
Help -> About Groovy/Grails Tool Suite == Version: 3.6.0.RELEASE
You can change your compiler level in (your workspace)/.settings/org.eclipse.jdt.groovy.core.prefs
We had this same problem with a project we had upgraded, switched from
groovy.compiler.level=23
to
groovy.compiler.level=21
and all the errors went away.
Seems like you're experiencing some sort of mismatch between versions of Java, Groovy Compiler and Grails. Perhaps your Groovy compiler is the latest 2.3.x from the update site but Grails version is lower than latest. Try starting GGTS 3.6 with Java 8 VM also set it as currently installed JRE in the preferences, set Groovy compiler to 2.3.3 and use Grails 2.4.1 or later.
Groovy below 2.3 and Grails below 2.4 don't support Java 8. I'd play around with the versions of Java, Groovy compiler in Eclipse preferences and Grails version to fix this problem.

Automatic Compiler Compliance Choice based on Build Path in Eclipse? (Or Vice Versa?)

My default JRE in Eclipse is JDK 1.7. I also have JDK 1.6 for projects that don't need Java 7. My default compiler compliance level is naturally JDK 1.7, in accordance with the default JRE.
Now, for projects that use Java 6 (configured in Project Properties -> Java Build Path), Eclipse does not automatically use JDK 1.6 compliance under Project Properties -> Java Compiler. Instead, it uses the workspace default 1.7 which leads to the problem described here: Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0).
Is there a way to configure Eclipse to use the compiler compliance level that matches the chosen JRE (or vice versa) or do I have to manually configure both for all projects that don't use the default JRE?
Preferences -> Java -> Installed JREs -> Execution Environments
There you map installed JVMs to Java language versions (and yours probably maps the Java 6 environment to the Java 7 JVM). Afterwards set your project build path setting to that Execution Environment (not the JRE or workspace default JRE).

Netbeans 6.8 - Alternative compile and runtime jdks/jre versions

Have a scenario where i need to compile my project with jdk 1.5 but run it with jre 1.6. I can't find a way to switch the jre that is used when running my program. I read something about execution profiles in an earlier version of netbeans, but 6.8 doesn't seem to support this. Any ideas?
Seems easy to do in eclipse.
You go to project-> properties - > sources ->binary source format and you pick your jdk 1.5 in your case. In libraries you can pick Java Platform