How to install java 1.8 in eclipse - java

I hava a mac and It has java JVM 1.6 that I use in eclipse kepler and I want to update the JVM to 1.8. How do I do that?

Simply install it (e.g. https://askubuntu.com/questions/464755/how-to-install-openjdk-8-on-14-04-lts)
Then add it to the JDK selection in Preferences/Java/Installed JREs:
You may have to search for the JDK path (e.g. in /usr/lib/java or /Libraries/java)

Install the JDK on your OS.
Then, check the preferences and look for Java->Installed JREs. Click add. (On Windows, it is Windows->Preferences, or Eclipse->Preferences on a Mac).

Related

Unable to locate executable for jre1.8.0_77

Says on my eclipse "Unable to locate executable for jre1.8.0_77". It also deleted the JREs :( I tried to run my project and went into Windows and preferences to add it but I couldn't.
Go to Windows > Preferences.
Locate Java > Installed JREs. (Or simply type JREs in the search
box).
The screen will show the list of JREs.
Click on Add button, locate the new folder on your machine and select.
Remove the old JRE from the list.
Same Question has asked before and here's the Link - How to change default JRE for all Eclipse workspaces?
Maybe you updated Java version but your PC's environment variable for JRE is still referring to the old version of JRE. If you updated Java, update your environment variable also.
recently i encountered same issue,
this happened after i updated my jre
because of this there was mismatch with jdk and jre versions
uninstalled java and installed newer JDK (SE ) kit. https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
now both jdk and jre are same

ADT can't find installed JREs on Mac

I have ADT Installed. v23.0.2.
I tried to import simple java project, but found no installed JRE to compile the code. I then installed JDK & JRE from Java SE downloads. I yet don't see any JRE in the list. Anything am I missing? any hooks ?
If it does not find it "automagically" then you need to "Add" it or "Search" it. Most likely though, when you installed the JRE, it was not properly added to the "path" or another install problem.
See this post:
How to install JRE 1.7 on Mac OS X and use it with Eclipse?
Chances are "Search" will do what you need.

Create new Java project, java preferences unavailable

I finished installing Eclipse 3.7.2 (Indigo) on my Ubuntu 12.04 system.
I am unable to have any options pertaining to either creating a Java project, running one as a Java project, can't find any of the Java preferences for JRE settings... There is no Java Development Toolkit in the Help section. I had all this earlier, I am not sure what changed. I am assuming that this has something to do with the SDK but have no other clue.
You might not have a system JRE installed. Press ctl + alt + T to open your Terminal
and then try running:
sudo apt-get install default-jre
Note: this will install Java 1.7, if you want 1.6 then you have to specify that
Then in Eclipse, make sure you have your environment setup correctly.
If you want the official JavaDoc, here how to set it up:
How do I add the Java API documentation to Eclipse?
Here is a link to the JavaDoc that you can use in your preferences:
http://java.sun.com/javase/6/docs/api/
Install your preffered JDK, then go Preferences -> Java -> Installed JREs and point to the fresh install.
Also, check Preferences -> General -> Capabilities. Make sure you have Development selected.

Compile Java 1.5 web app in Netbeans on Mac OSX 10.7.5

I am running Netbeans on my Mac OSX 10.7.5 which uses Java 1.6. I need to compile my web app in Netbeans against Java 1.5. I tried to install Java 1.5 on my Mac OSX, but it will not let you. How can I compile my netbeans web app against Java 1.5 on my mac osx?
Go to Tools -> Java Platforms. There, click on Add Platform, point it to YOUR_JDK_LOCATION. You can either set the another JDK version or remove existing versions.
after adding multiple platform change your project compile specification according to your requirement
To download jdk binary please visit below location
Link 1 zip file
Link 2 tar file
change your java version
$ export JAVA_HOME=/usr/libexec/java_home -v '1.5*'`
OR
parameterize the compiler like javac -source 1.5 -target 1.5
I believe I figured it out. In Netbeans, if you right click your project and go to 'Properties', in the 'Sources' category there is an option that says 'Source/Binary Format' which contains a drop down list where you can select the JDK version to build your project.
Since I am running JDK 6 on my mac, it will allow you to select version 6 and below, and in my case, I select version 5.

unsupported major.minor version .51 and running java 1.7 code on java 1.6

On my work computer, I have Windows 7 x64 with JDK 1.7 installed. I created a project in Netbeans and all went well. I then copied my project onto my home computer that is running Mac OS X 10.6, which is running JDK 1.6. The build fails with an error message about an unsupported major.minor version .51. Googling and searching concludes that it is because of a JDK version mismatch. Oracle does not allow JDK 1.7 to be installed on Mac OS X 10.6, so I am stuck with JDK 1.6 on my Mac.
Is there a way I can take my 1.7 code and get it to build and run on my Mac OS X 10.6 running JDK 1.6? Or is there way I can take my code back to my JDK 1.7 machine and downgrade the compatibility to 1.6? Basically I need the code to run on my work computer and home computer.
Open Project Properties in NetBeans and set the platform and language level to 6 (or 1.6). Then clean and build. You can't use any Java 7 features though. You should be able to do this with your existing Java 7 install on Windows; you shouldn't need to install Java 6.
Alternatively, you can install an unofficial OpenJDK 7 build on your Mac running 10.6. Look here for downloads:
http://code.google.com/p/openjdk-osx-build/
Unless you are using new 1.7 syntax/libraries, you should have no problem building your classes with JDK 1.6
You can also generate 1.6 compatible .class with 1.7 compiler, something like running
javac -source 1.6 -target 1.6 MyClass.java
or if you are using Eclipse, you can set this in a setting dialog.
So the answer is, both ways may work for you.
edit:
corrected my answer.
-source has to be 1.6
Thanks to Stuart Marks for pointing it out!
This will require you to have Java 1.6 installed on you Windows box. There a syntax incompatibilities between 1.7 & 1.6 (as well as some API differences).
In Netbeans, right click the project node and select "Properties". From the properties dialog, select sources. At the bottom of the dialog, you should see "Source/Binary Format", from the drop down, select "JDK 6"
Select "Libraries". At the top of the dialog, you should see "Java Platform", from the drop down, you will need to select "JDK 1.6"
If you can't find it, click "Manage Platforms". Click "Add Platform", browse to where you installed Java 6 (usually in C:\Program Files\Java) and select it. Click "Finish".
Now you should be able to find it
UPDATE
From comments made by "su-", you may be able to get away with simply changing the "Source/Binary Format" option to 1.6

Categories

Resources