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

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.

Related

Update Maven Keeps Reverting Back to JavaSE -1.8 in Eclipse from Java JDK 1.8

How do I stop maven from constantly updating my Java System Library from JDK 1.8 back to Java SE 1.8? I have configured the build path and I even set my Java_Home Variable to the JDK path. I have also have updated the build configuration. Can someone please specify how to do this with some specific instructions as I am a novice. I also noticed this keeps changing back as well. FYI I am using Eclipse Mars if that matters.
In Regards to the comments below I have shared the Eclipse M2e Plugin screenshot. Even when selected I am not able to proceed to next. I also have shown what's already installed just in case another plugin is hindering me from using the m2e
You need to understand what an Execution Environment (EE) is in Eclipse. The concept of EE is an abstraction over JREs, allowing projects to be configured without absolute paths to JRE locations. From the wiki page:
Execution environments (EEs) are symbolic representations of JREs. For example, rather than talking about a specific JRE, with a specific name at a specific location on your disk, you can talk about the J2SE-1.4 execution environment. The system can then be configured to use a specific JRE to implement that execution environment.
In general, it's not advisable to configure a project to use "Workspace default" as its JRE System Library, because that makes the project inconsistent when loaded into different workspaces. Think about this: what if the project is being developed targeting Java 7, but I pull it into my workspace which has JDK 8; that could be a big problem. By using an EE, the project is configured such that it doesn't know (or care) where I actually have a matching JRE on my system.
I said all that to set up the answer for you, so you understand what Maven is doing and these instructions are doing. m2e, the Maven integration plugin for Eclipse, is (rightly) setting the project configuration to use an EE instead of "workspace default". From your screen shot I can see that you have both JDK and JRE 1.8 set up in your workspace, so ideally you should remove one (the JRE). Got to Preferences > Java > Installed JREs. There you'll see both the JRE and JDK listed. I suggest removing the JRE*.
Then go into the "Execution Environments" preferences section, select JavaSE-1.8 and make sure that your JDK is checked as the default implementation.
Now when m2e configures your projects to use an EE, that EE will be pointing to the JDK you have installed. And if someone else imports the project, it will point to wherever they have a matching JDK installed.
*By the way, it's perfectly acceptable and normal to have different versions of Java there; I often work on different projects that target different Java versions.

Source code compatibility setting in Eclipse

I have jre7 installed on my pc.
In Eclipse Kepler I created a project with compiler compliance level 1.5.
The source compatibility setting is 1.5 too. But this setting not works.
I can wirte code which using methods that were declared in 1.6 or later. For example:
String s = "aaa";
boolean b = s.isEmpty();
The method isEmpty() in java.lang.String is since 1.6.
Of course, when running the generated class file with a real jre 1.5 enviroment, i got a NoSuchMethodError exception.
Here is my source and settings:
How can I fix this? Or is it an Eclipse bug?
The settings are releated to the -source and -target flags for the javac compiler which enables backwards compatibility (for an explanation, see for example this SO question and answer).
This is mostly a technical option and not a feature, i.e. these settings in Eclipse were never intended to free you of the burden of knowing what is and is not available in an old JRE. But Eclipse does provide you the option to make it so and even shows you a warning message at the bottom of the Java Compiler options screen on how to make it so (and yes, that does involve downloading and installing the old (target) version of the JRE - there is no way around that).
Whether or not a method from Java 6 is available depends on the JRE library that you are using.
Go to "Java Build Path", into the "Libraries" tab, remove the "JRE System Library" of Java 7. Then, click "Add library..." and go though the dialogs for adding a Java 5 JRE Library. (Of course, a Java 5 JRE has to be installed for that...).
(Note: There is also a message about this in the right screenshot, at the bottom...)

Android ADK error: There are no JREs installed in the workspace that are strictly compatible with this environment

I seem to have solved the immediate compile errors, but would appreciate some deeper insight and have not found anything on StackExchange or Googling the error message that appears directly applicable.
Have been using Android Development Kit plugin for Eclipse for only a few weeks now. I understand that Android only uses syntax through Java 1.5 and suspect that may be a clue to my problem which only occurred after I added a Debug.startMethodTracing("filename.trace"); and added WRITE_EXTERNAL_STORAGE uses-permissions.
Successfully compiled and ran simple (hello world style) apps, then all of a sudden: bam!!
Brand new error message:
"Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment."
When I checked the Java Build path for my app:
Right click project name > Properties > Java Build Path > Libraries
There were only four items:
1) An imported jar file library (for an API)
2) Android 4.4.2
3) Android Dependencies
4) Android Private Libraries
I seem to have solved the problem by following these non-Android specific instructions:
Java Build Path
which essentially said to:
'Add Library" > 'JRE System Library" > "Workspace default JRE (jre7)
and now my code appears to be compiling again. However, I am somewhat uncomfortable with my level of understanding of why it was necessary to do this (I just checked and Jdk1.7 is still in my system path and seemed to work fine before). Is this usually necessary when developing for Android?
In other words, is it normal for a JRE to be explicitly listed in the libraries section with the ADK?
Is there any problem with using JRE 1.7 instead of an older version?
I also read these instructions, but again, the answer is not specific to Android:
Warning - Build path specifies execution environment J2SE-1.4
The warning is letting you know that you don't have any actual 1.6-version JDKs available, even though your code is set to a 1.6 compliance level. The practical pitfall is that since the only JRE runtime available is the 1.7 runtime, you might use some class or method that was added in 1.7: Your code would still compile just fine, but then you'd get a NoSuchMethodError or such if it was run on a 1.6 runtime.
In practical terms, since you're targeting Android, you probably don't need to worry; the ADK is going to recompile your code anyway, and any such errors should show up immediately. If you do want the warning gone, just install the 1.6 JDK alongside the 1.7.

Setup eclipse java SE-1.7

I wanted to start learning java but Eclipse is giving me some trouble.
First of all I'm a beginner with Java with little to no knowledge about it. I want to use 'JavaSe-1.7'. I have no clear reason to use it besides using the latest version. After downloading Eclipse (Eclipse IDE for Java Developers) I created a new Java project and selected 'use an execution eviorment JRE : JavaSE-1.7'. This directly popped the notification saying 'The default compiler compliance level for the current workspace is 1.6. The new project will use a project specific compiler compliance level of 1.7.'. I finished creating the project and started following some tutorials.
However I noticed directly I have 2 errors which dont explain anything or have a source. I ignored it and started typing and tried to import 'java.io.console' however it said 'The import java.io cannot be resolved' and I have no idea what is the cause of it neither how to fix this.
Would like some instructions into the right direction.
Thanks in advance
Check your Eclipse preferences: Java -> Installed JREs. The one that you're using should be marked and it should be a JDK not just a JRE.
Also check your project's build path: Right click on the project -> Properties -> Java Build Path
Check in the "libraries" folder whether the JRE System Library is present and if not add it using "Add library"->"JRE System Library" and then select the correct one (from an installed JDK).
You may not have your JDK/JRE set up correctly.
Check the following:
Did you install a JDK or just the JSE? The JDK is needed to compile .java files to .class files. Without it, you can only run java programs, not develop them. If not, download and install it from Oracle website.
Check in Eclipse, if you have the JRE installed there as well. You just need to specify the path to the installation. You can reach this screen via the "Window->Prefrences" menu. see this screenshot:
The message you receive about project specific compiler compliance level is not a problem, it just means that your workspace is set up to comply to java 1.6 but your project will comply to java 1.7 standards. Also, Java 7 in general is no problem whatsoever.
Paths may differ, especially if you're not running a *nix OS. Just point the location to where you installed your JDK.

Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties

Did anybody have similar problem with this, I import android project and I get
errors like
[2011-10-03 17:20:09 - Screen] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2011-10-03 17:21:55 - App] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
[2011-10-03 17:21:59 - App] Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.
I got errors to delete all #Override above functions. I have Windows 7 x64, jvm7 x64. Does anyone have clue what is wrong ?( I done Android Tools -> Fix Project Properties but didn;t help )
That isn't the problem, Jack. Android SDK isn't x64, but works ok with x64 jvm (and x64 eclipse IDE).
As helios said, you must set project compatibility to Java 5.0 or Java 6.0.
To do that, 2 options:
Right-click on your project and select "Android Tools -> Fix
Project Properties" (if this din't work, try second option)
Right-click on your project and select "Properties -> Java
Compiler", check "Enable project specific settings" and select
1.5 or 1.6 from "Compiler compliance settings" select box.
Go to the project folder and right click on it -> properties -> check off the read only box and click ok
Right-click on your project and select "Android Tools -> Fix Project Properties"
Right-click on your project and select "Properties -> Java Compiler", check "Enable project specific settings" and select 1.5 or 1.6 from "Compiler compliance settings" select box. (try all the levels one by one just in case)
Under Window -> Preferences -> Java -> Compiler, set Compiler compliance level to 1.6 or 1.5.
Hopefully it will settle the problem.
I would recommend using x86 version of jvm. When I first got my new laptop (x64), I wanted to go x64 all the way (jvm, jdk, jre, eclipse, etc..). But once I finished setting everything up I realized that the Android SDK wasn't x64, so I had issues. Go back to x86 jvm and you should be ok.
EDIT: 11/14/13
I've seen some recent activity and figured I would elaborate a little more.
I did not say it would not work with x64, I just recommended using x86.
Here is a good post on the advantages / disadvantages of x64 JDK. Benefits of 64bit Java platform
Thought process: To what end? Why am I trying to using 64 bit JDK? Just because I have a 64-bit OS? Do I need any of the features of 64-bit JDK? Are there any extra features in the 64-bit JDK?! Why won't this s*** play nice together!? F*** it I'm going 32-bit.
Doing Project -> Clean... fixed it for me.
My eclipse had stopped working so I cleaned workspace directory and after I run eclipse when I import the project I had this problem. Other solutions suggested here didn't work.
For most of the people still receiving the error after fixing project properties, you probably installed Java 7 SDK when setting up your environment, but it is not currently supported for Android development.
As the error message sais, you should have installed Java 5.0 or 6.0, but Java 7 was found.
If you fix project properties without first installing Java 5 or 6, you will see the same error again.
So first, ensure you have Java SDK 5 or 6 installed, or install it.
Check your environment variable (JAVA_HOME) is pointing to SDK 5/6.
And then:
Check that Eclipse is using SDK 5/6 by default (Window => Prefs. => Java => Compiler
Disable Project Specific Settings (Project Properties => Java Compiler)
Fix Project Properties
OR
Leave Eclipse using JDK 7 by default.
Enable Project Specific Settings (Project Properties => Java Compiler)
Select Compiler Compliance 1.5 or 1.6 (Project Properties => Java Compiler)
I agree with BMSAndroidDroid and Flo-Scheild-Bobby. I was doing a tutorial called DailyQuote and had used the Cordova library. I then changed my OS from Windows to Ubuntu and tried to import projects into Eclipse, (I'm using Eclipse Juno 64-bit, on Ubuntu 12.04 64-bit, Oracle JDK 7. I also installed the Ubuntu 32-bit libs- so no issues with 64 and 32bit), and got the same issue.
As suggested by Flo-Scheild-Bobby, open configure build path and add the jar(s) again that you added before. Then remove the old jar link(s) and thats it.
I fixed this problem employing the two procedures of :
In Eclipse->'Project' menu -> 'Java Compiler' -> set 'Compiler compliance level' = 1.6
check on 'Use default compliance settings'
Set 'Generated .class compatibility' = 1.6
Set 'Source compatibilty' = 1.6
Then go to 'Windows' menu --> 'Preferences' -->'Java' , expand 'Java' --> 'Compiler' -->Set 'Compiler compliance level' = 1.6
Hint: Source compatibility must be equal to or less than compliance level.
I would suggest that u check for the jar files are properly included in your projects. There are possibility that in absence of jar files, the project will not be compiled
As BMSAndroidDroid said, this problem may be caused by a wrong build path configuration.
If you included some libraries to your build path, then move the libraries, the build path will conserve the wrong references, will not found the libraries during compilation and you will get an error.
To fix it, right click on your project folder > build path > configure build path
Then take a look to the library tab, and remove the old libraries.
In my case a switch from openjdk7 to openjdk6 helped. Afterwards I changed the compliance level to 1.6 and all compiled fine.
i come across this problem cause my debug.keystore is expired, so i deleted the debug.keystore under .android folder, and the eclipse will regenerate a new debug.keystore, then i fixed th
Following worked for me
Enable project-specific settings and set the compliance level to 1.6
How can you do that?
In your Eclipse Package Explorer 3rd click on your project and select properties. Properties Window will open. Select Java Compiler on the left panel of the window. Now Enable project specific settings and set the Complier compliance level to 1.6. Select Apply and then OK.

Categories

Resources