JDK on OSX 10.7 Lion - eclipse

I've instaled the Java for Developer package provided from Apple for 10.7 and java apps are running fine
but eclipse cannot find the JDK root path and I cant either.
Anybody any ideas?

You can download the 10.7 Lion JDK from http://connect.apple.com.
Sign in and click the java section on the right.
The jdk is installed into a different location then previous. This will result in IDEs (such as Eclipse) being unable to locate source code and javadocs.
At the time of writing the JDK ended up here:
/Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home
Open up eclipse preferences and go to Java --> Installed JREs page
Rather than use the "JVM Contents (MacOS X Default) we will need to use the JDK location
At the time of writing Search is not aware of the new JDK location; we we will need to click on the Add button
From the Add JRE wizard choose "MacOS X VM" for the JRE Type
For the JRE Definition Page we need to fill in the following:
JRE Home: /Library/Java/JavaVirtualMachines/1.6.0_26-b03-383.jdk/Contents/Home
The other fields will now auto fill, with the default JRE name being "Home".
You can quickly correct this to something more meaningful:
JRE name: System JDK
Finish the wizard and return to the Installed JREs page
Choose "System JDK" from the list
You can now develop normally with:
javadocs correctly shown for base classes
source code correctly shown when debugging

On newer versions of OS X you should find ALL JREs (and JDKs) under
/Library/Java/JavaVirtualMachines/
/System/Library/Java/JavaVirtualMachines/
the old path
/System/Library/Frameworks/JavaVM.framework/
has been deprecated.
Here is the official deprecation note:
http://developer.apple.com/library/mac/#releasenotes/Java/JavaSnowLeopardUpdate3LeopardUpdate8RN/NewandNoteworthy/NewandNoteworthy.html#//apple_ref/doc/uid/TP40010380-CH4-SW1

I have just ran into the same problem after updating. The JRE that is downloaded by OSX Lion is missing JavaRuntimeSupport.jar which will work but can wreck havoc on a lot of things. If you've updated, and you had a working JDK/JRE installed prior to that, do the following in Eclipse:
1) Project > Properties > Java Build Path > Select broken JRE/JDK > Edit
2) Select "Alternate JRE"
3) Click "Installed JREs..."
4) In the window that opens, click "Search..."
If all goes well, it will find your older JRE/JDK. Mine was in this location:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

For Mountain Lion, Apple's java is up to 1.6.0_35-b10-428.jdk as of today.
It is indeed located under /Library/Java/JavaVirtualMachines .
You just download
"Java for OS X 2012-005 Developer Package" (Sept 6, 2012)
from
http://connect.apple.com/
In my view, Apple's naming is at least a bit confusing; why "-005" - is this the fifth version, or the fifth of five installers one needs?
And then run the installer; then follow the above steps inside Eclipse.

You can download jdk6 here http://support.apple.com/kb/DL1573
Wish it helps

Related

Netbeans Installation cannot find JRE

I am trying to install Netbeans 8.2 on my Microsoft surface pro and I am using JDK 10.0.2. When I run the Netbeans installer it is unable to find the JDK. So I used the --javahome command with the correct file destination and I suppose it finds the JDK. But then it throws the same error for the JRE. I do not know why the JRE cannot be found. I have been reading many similar questions and am seeing directions saying to use JAVA_HOME and set the environment variables. I am very unfamiliar with the windows command prompt, so I would appreciate a more specific solution.
As much as I know, JDK doesn't come with JRE, so check in your Java folder if you got JRE installed, if not, try downloading it manually.
Hope that helps
Version 8.2 of NetBeans does not support JDK 10.
However, ownership of NetBeans has recently been moved from Oracle to Apache and you can use JDK 10 with NetBeans 9.0 RC1 (RC = "Release Candidate").
Just download the zip file, unzip it and then locate and run netbeans64.exe (or netbeans.exe for 32-bit) within the unzipped folder. Those steps are the same regardless of operating system.
When NetBeans starts it should automatically locate your installed JDKs, but verify that you have JDK 10 included as a Java Platform from the Tools > Java Platforms screen:
You can explicitly add JDK 10 to NetBeans if necessary:
Tools > Java Platforms
Click Add Platform and complete the wizard to add JDK 10.
Once you have JDK 10 included in Java Platforms you can create a trivial Java 10 project, although the process is not completely intuitive:
File > New Project > Java > Java Application
Accept all the default options. A new project with a name of the form JavaApplication{n} will be created.
In the Projects panel select the project's node, right click and select Properties from the popup menu.
Select Libraries from the list of Categories and set Java Platform to JDK 10.
Select Sources from the list of Categories, set Source/Binary Format to JDK 10 and click OK.
You now have a Java 10 project. To verify that, make sure that the following code compiles as your main() method:
public static void main(String[] args) {
var v = 7;
}

PyDev not showing up in Eclipse

I just installed Eclipse Kepler (after an issue with a faulty update in Juno) and tried to install PyDev using the Install New Software option in Eclipse. Basically just following memory/online tutorials. After installing I can't see it in my Preferences pane. Any ideas why that might be so?
Thanks.
Yes, I have Java 7 installed.
UPDATE: A lot of users have suggested numerous solutions to this problem. There may be more than one correct answer below. See what helps you...
Too much!
After wasting 4 hours trying to install PyDev 3, I moved back to 2.8.2 and used the drop in technique instead of Add new software and it now works!
Download 2.8.2 from sourceforge
http://sourceforge.net/projects/pydev/files/pydev/
Uninstall PyDev.
Simply unzip the contents into the dropins folder below eclipse.
Restart eclipse.
After struggling with this problem for some days I wanted to share my solution to the problem - inspired by the above posts (kudo's to them).
My Configuration:
MacBook Air (intel) with OS X 10.9
Eclipse: Kepler SR1 installed (zip file extracted in the Applications folder)
My situation:
Tried to install PyDev via Eclipse Help --> Install new software...
Installation was succesfull, but PyDev didn't show up anywhere in Eclipse.
My solution:
In Eclipse go to Help --> Install new software...
Uncheck "Show only the latest versions of available software"
Select PyDev the usual way, but install the latest 2.x version instead of the 3.x version
Apparently PyDev 3.0 does not work with the default OS X configuration of Eclipse, Java and Python (don't exactly know why, though...)
I just figured it out.
You will need JDK rather than a JRE.
Download it here first:JDK Download
Install it.
Explore /Applications/eclipse/Eclipse.app/Contents/MacOS (where you put your Eclipse)
Open eclipse.ini
add
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java
You will change the version according to your situation.
Enjoy!
It happened to me too, but using Debian stable (wheezy, in my case).
I solved installing doing:
# apt-get install openjdk-7-jdk
After this, I checked that I had two alternatives of Java JDK:
# update-java-alternatives -l
And the output was:
java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64
java-1.7.0-openjdk-amd64 1051 /usr/lib/jvm/java-1.7.0-openjdk-amd64
Finally, I did:
# update-java-alternatives -s java-1.7.0-openjdk-amd64
After that, I removed pydev plugin from Eclipse, reboot Eclipse, install pydev (using Marketplace), reboot Eclipse, and now it works.
Credits:
http://vas.davimas.name/2013/07/switching-between-openjdk-v6-and-v7-in.html and Richard's answer, above
Most likely you do not have java 7 or > eclipse 3.7 installed on your machine it is a requirement of pyDev 3 see here http://pydev.blogspot.co.uk/2013/11/pydev-30.html
The PyDev.org website states (http://pydev.org/manual_101_install.html) --
"""
Important requisite
PyDev now requires java 7 in order to run. If you don't have java 7, the update
process may appear to succeed, but PyDev will simply not show in the target
installation. Please double-check if you're using a java 7 vm in
about > installation details > configuration
before trying to install PyDev.
"""
This problem started to appear in my Eclipse after I removed the Java 7 runtime from my system (because the Java code I am building needs to run on an older version of Java, but that's unrelated). After I realized that I had lost PyDev, I reinstalled Java 7 and PyDev is working fine now.
Another option would be to rollback to the previous version of PyDev that does not require Java 7, but it would require a manual installation of PyDev and I would lose the convenience of automated updates. The best way forward, it seems, to run run Eclipse on Java 7 and switch those Java projects that need to depend explicitly on Java 6 to that JDK/JRE.
How I was able to get pydev to work in mac/eclipse is download the latest JDK as mention 100 times above install it and then do the following.
open eclipse choose preferences > java > installed JREs
click on "Search..." button it will auto populate the JDK 1.7 you just installed
Click ok
have a beer!
-Cheers!
Solved.
OSX Mavericks 10.9, Eclipse Keplar 4.3.2, PyDev 3.4
Problem: PyDev not showing up under Ecplise > preferences
Solution: Download, install and point Ecplise to JDK 1.7
Unistall PyDev
Under Eclipse > preferences > Installed JREs you probably only see Java SE 6
Download and install JDK 1.7 from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
open terminal and run "/usr/libexec/java_home -v 1.7"
this will return the directory in which JDK 1.7 reside, something like /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
Under Eclipse > preferences > Installed JREs click "add", select "MacOS X VM", click "next"
in JRE Home paste your version of /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home, give it a name and click "Finish"
Restart Eclipse and re-install PyDev.
Voila!
I had the same issue on Luna and found my mistake.
After checking the author in "Do you trust these certificates?" page, and I was able to successfully install pydev.
The page lets you proceed without checking it, and no error occurs and it was where I totally missed. Maybe it is useful for someone.
You can move back to 2.x.x:
Eclipse -> About Eclipse then click "Installation Details" button.
From "Installation History" tab choose last installation.
Click Revert button.
You will go back to chosen installation.
I managed to get the following to work with Eclipse IDE for Java Developers 4.4.1 Luna on OS X 10.9.5 Mavericks:
Download and install the latest version of the JDK (currently Java SE 8u25) from http://www.oracle.com/technetwork/java/javase/downloads/index.html. (Not the JRE!)
Navigate to /Applications/eclipse/Eclipse.app/Contents/MacOS (or wherever you have Eclipse installed) and open eclipse.ini.
Append the following to the bottom of the file (be sure to replace the version number with yours):
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java
Download the latest version of PyDev (currently 3.8.0) from SourceForge at http://sourceforge.net/projects/pydev/files/pydev/.
Unzip its contents to /Applications/eclipse/dropins (or wherever you have Eclipse installed) and restart Eclipse.
Hope this helps anyone who's still having the issue. Special thanks to Mohammed Lokhandwala and braineo.
Aha , It is solved just now.I show it in the following.
First , I use MyEclipse with jdk1.8,maybe some people dont know that Eclipse (or MyEclipse) has its own jvm , what is not "jdk" you downloaded and installed and the "built-in jvm" is default. You can check this out by clicking like this " Windows-->preferences-->Java-->Installed JREs" And I found my MyEclipse used the default jdk1.6 .Then I click "add" to build path of my installed jdk1.8 .
Second , I opened the configuration file named "myeclipse.ini" and check this in the following.
binary/com.sun.java.jdk.win32.x86_64_1.6.0.u43/bin/javaw.exe
Third , I replaced it with new path . Check the following out. It is new path.
D:/jdk/java/jdk1.8/bin/javaw.exe
Last , restart it .And you can find "PyDev" in "Preference".
Happy Coding with Python!
PS:Pycharm is good,and you can get it for free if you are a student or a teacher. click here
I was experiencing the same problem using java 1.7.0_101.
Updated to 1.8.0_91 and "voilá"! PyDev finally appeared.
After trying all of the listed ways to work with 1.7 I was still seeing error message when Eclipse tried to open the editors and navigators on startup. But when I created a new project it worked. Then I tried just closing all editors and reopening them and they too work. The navigator had also set itself to working set and showed nothing. When I switched that to projects it also started working.
The same thing happened to me. This is how i fixed it.
Click on "install new software" - it's under help.
Click on " what is already installed"
Uninstall PyDev
Reinstall PyDev BUT instead of the 3.3XX version, install the latest 2.XX version (i.e click on the drop down menu and select the latest 2.XX version)
It worked for me!
So I tired many of the suggestion above, and I think what finally got it to work is instal the JDK from: http://www.oracle.com/technetwork/java/javase/downloads/index.html. You might also need to uninstall the pydev plugin and reinstall it again. But after install the JDK 8, I got the Pydev to show up under preference.
menu Help > Install New Software...
don't fill "works with" but click on Add...
In the next screen, add the update site of PyDev and PyDev Extensions:
Name : PyDev and PyDev Extensions
Location: http://pydev.org/updates
and go on...
pydev 3 is buggy! Use 2.8 and you should be fine.
I also had this problem, wanted to use python3.4 as interpreter and it wasn't compatible with pydev 2.8 so after a few trials I found out that if you install pydev 2.5 everything works fine !! (At least on Eclipse Kepler).
I know this thread is old but I thought I might contribute my solution because none of the suggestions above worked for my Mac running Yosemite [10.10.2]. I hope this will be helpful to someone else. Despite updating to the latest JDK my mac kept reporting a wrong version. It turns out the symlink was point to the old version and fixing that issue got my pydev/eclipse working.
Find out the current default Java version
Java -version
Get installed versions
/usr/libexec/java_home -V
Navigate to the following folder and delete the current symlink
cd /System/Library/Frameworks/JavaVM.framework/Versions/
rm CurrentJDK
Create a new symlink pointing it to the newer installation substituting 'new-version' with appropriate version from 2 above. i.e jdk1.8.0_40.jdk
ln -s /Library/Java/JavaVirtualMachines/<new-version>/Contents/ CurrentJDK
Confirm your default version
Java -version
Restart.
Happy coding.. :)
I had to uninstall pyDev 3 and install 2.8 to get this working with Eclipse (V 4.4) and Yosemite (V 10.10)
The easiest way is just getting http://www.liclipse.com/ which has everything setup from the start... if you don't want to go that route (as LiClipse is commercial) you may want to try to specify the java 7 install manually:
Grabbed from http://pydev.org/download.html:
Well, the main issue at this time is that PyDev requires Java 7 in order to run. So, if you don't want to support PyDev by going the LiClipse route (which is mostly a PyDev standalone plus some goodies), you may have to go through some loops to make sure that you're actually using Java 7 to run Eclipse/PyDev (as explained below).
All OSes
Make sure you download/install the latest Java 7 JRE or JDK, try restarting to see if it got it automatically.
I.e.: in help > about > installation details > configuration check if it's actually using the java 7 version you pointed at.
If it didn't get it automatically, follow the instructions from:
http://wiki.eclipse.org/Eclipse.ini to add the -vm argument to eclipse.ini on "Specifying the JVM" to specify the java 7 vm.
Note on Mac OS: You can use the command "/usr/libexec/java_home -v 1.7" to get the base path for the JVM (though you also need to append "/bin/java" to the output of said command to the -vm arg in eclipse.ini).
Solution
Using standard Eclipse installation method:
In Install New Software, Add a new site to Work With. I called my entry PyDev Old and entered the Location:
https://dl.bintray.com/fabioz/pydev/old/site.xml
That has PyDev for Eclipse versions 2.8.2 to 4.5.3
Details
I am working with Indigo (3.7) and so need a version of PyDev that is older than 3.0.0. My JDK is 7 as noted elsewhere in this question. The option for Show only the latest versions of available software is turned off.
The standard advice for getting PyDev is to use http://pydev.org/updates and turn off the only latest option. That now only lists PyDev 5.
I had the same issue!
Just update all three SWs to the latest version and it will solve the problem.
Do like this:
update Eclipse to Luna Service Release 2 (4.4.2) 64-bit, then
PyDev - Python IDE for Eclipse 5.1.2 from Eclipse Marketplace and then
download and update the Java SE Development Kit 8u92 64-bit
It should work well now!
I had the same issue in Eclipse 4.4. Had to use a previous version of PyDev. It simply seems to be a matter of using the correct Java JRE/JDK and PyDev for the version of Eclipse you're running.
From http://www.pydev.org/
Release 5.2.0
Important PyDev now requires Java 8 and Eclipse 4.5 onwards.
PyDev 4.5.5 is the last release supporting Java 7 and Eclipse 3.8.
See: update sites page (http://www.pydev.org/update_sites/index.html) for the update site of older versions of PyDev.
Oct 2016:
Installed fresh new copy of Java JDK 1.8.0_102 took care of the incompatible OSX JRE 1.6
Installed fresh copy of Eclipse Neon 4.6.1
Followed pydev manual: http://www.pydev.org/manual_101_install.html
all working fine now...
First install and setup following applications as these are mentioned in above answers:
Jave (version 8 or greater)
Eclipse(version Neon/Oxygen or greater)
PyDev in Eclipse
Now go through following steps:
Eclipse -> Window -> Perspective -> Open Perspective -> Other..
Select PyDev in the list.
Click Open.
Now you are all set.
Cheers!!!
Make sure you install the 64-bit version of Eclipse if you can. If so you should be able to use the latest version of Pydev without any problem.

GlassFish in Eclipse complains "GlassFish v3 requires a JDK 1.6 and not a JRE"

I am running:
Eclipse Java EE IDE for Web Developers.
Version: Helios Service Release 2
Build id: 20110218-0911
I have also installed Java EE 6 SDK Update 2 which includes:
GlassFish Open Source Edition 3.1
Java EE 6 Code Samples
Java EE 6 API Documentation
Java EE 6 Tutorial
Your First Cup: An Introduction to the Java EE Platform
I have registered GlassFish with Eclipse but when I try to start the server, I get the following error:
GlassFish v3 requires a JDK 1.6 and not a JRE. Please add/select the correct JDK in the Server properties 'Runtime Environment' section.
I have searched here for an answer but none so far seem to work. Can anybody suggest how I would sort this error out?
I had the same issue and actually i got the solution from this link ( The above answers really didnt gave me the solution
https://forums.oracle.com/forums/thread.jspa?messageID=7033028
1) make sure the jdk is installed. Look in C:\Program Files\Java\jdk1.6.XXXX (mine says 0_16). If that has stuff in it the jdk probably was installed, if not you can grab just the jdk from http://java.sun.com/javase/downloads/index.jsp
2) This is where the error message kinda foobars ya...
- Get eclipse started, ignore the message.
- Go to Window>Preferences
- Then under +Java+Installed JREs hit Add.
- Select 'Standard VM' then Next
- JRE Home = C:\Program Files\Java\jdk1.6.XXXX the rest should fill in automagically. Hit Finish.
- MOST IMPORTANT!!! Click the check box back in the Preferences Window for the new jdk runtime...I don't know why it's necessary, but it definitely is...
3)Still in Preference Window.
- Get to +Server, Runtime Environments
- Select the Glassfish SRE, hit Edit...
- From the JRE drop down grab the JDK and hit Finish
- Hit Okay.
4)Go to the Servers Veiw (probably down by the Console View).
Right click on the Bundled Glassfish...Server and hit restart/start...
Yes, you downloaded (or pointed Eclipse to) a JRE, but it needs a JDK. The latter has all the Java tools: javac.exe, java.exe, jar.exe, etc.
If you look at the directory where you told Eclipse to look for a JDK, you must see a /bin directory with those .exe files in it. If you don't, you know why the error message.
Make sure you downloaded a JDK and point Eclipse to it.
One more check: see if you can start Glassfish without Eclipse. You're ignorant of two things if you're learning both at the same time. Leave one unknown out of the equation until you can make Glassfish run on its own.
You need a JAVA_HOME environment variable. What's it pointing to? If you don't have one, create it.
For other people like me who still have a problem, try to be careful in your JRE Definition :
Don't use this : C:\Program Files\Java\jdk1.6.0_29\jre
but this : C:\Program Files\Java\jdk1.6.0_29
and Glassfish will eventually work.
It took me a while to find where this is configured in eclipse so I'll note it here for everyone:
Window menu > Preferences dialog > Server section > Runtime Environments subsection.

How to (re)attach JDK sources for Eclipse on Snow Leopard?

After updating to the latest (and now deprecated, sniff...) update of Apple's JDK, Eclipse does not show the source code for JDK classes anymore. It asks me to attach the source location file or folder. Where can I find that?
It seems that Java for Mac OS X 10.6 Update 3 does not include the sources anymore. There is a separate package "Java for Mac OS X 10.6 Update 3 Developer Package" now. See http://lookfirst.com/2010/10/how-to-fix-missing-source-for-latest.html
For each update from Apple, I write a new blog post with the updated symlinks. I noticed a lot of traffic on my blog from one of the answers, so I figured I might as well update things with the latest release.
I could write a simple shell script to do this for you, but that would require you to download a file. Seems simpler to just execute a few easy commands.
This is the latest one for update 5:
http://lookfirst.com/2011/06/fix-missing-source-for-java-mac-os-x.html
I am using Mac OS 10.8.5. I downloaded the java for Mac OS 10.7 and installed it. I found the src.jar file in
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/src.jar.
Then I
Opened eclipse(JUNO)
Eclipse > Prefereces > JAVA > Installed jre
Edit the java listed
In the jre system libraries section,
Expand the first one (i.e., classes.jar)
You can see that src is not attached
Double click that and provide the above location
That's it.
In my case the sources are in
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar
You might need to set this in the Eclipse preferences: Java - installed JREs. Select the 1.6 JVM and click edit. Now select classes.jar from the list of JRE system libraries, click source attachment and enter the path to your src.jar.
To all the guys who's been suffering from searching the source code here and there for hours but finally get nothing.
For Eclipse to attach(imperfectly available for 1.6):
jdk1.7.0_21_src_for_mac.zip

How do i find out the JDK version Eclipse is using?

I see JRE all over the place, but i can not be sure which JDK is compiling my code. How do i find out?
You can still check/set which JDK version you want to compile to. If you go to Window->Preferences, then click "Java" from the menu on the left and then "Compiler". The first setting allows you to see which JDK version is being complied with.
I know this doesn't directly answer your question since JDK isn't actually compiling it, but hopefully it helps!
Actually Eclipse has its own compiler. You can develop java apps using only the JRE and Eclipse
You don't find JDK explicitly mentioned anywhere because way to point to a JDK is under the name of 'Installed JRE'. That is Window > Preferences > Java > Installed JREs. This is useful when using m2e plugin.
secondly apart from having it's own built in compiler, it is recommended to you install one of your own to support development of Java programs. Except below from eclipse wiki page :
If you intend to use Eclipse for Java development, then you should install a JDK