Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glassfish in eclipse doesn't seem to see my JDK

I am trying to get glassfish working in eclipse, and running into the JRE vs JDK 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 googled around and it seems a bunch of people had this issue. Sure enough in preferences->Server-> Runtime Environment when I clicked edit on the glassfish server runtime environment the JRE was "default JRE". I clicked the dropdown menu and switched it to my JDK: java-6-openjdk and figured I had the problem solved. Unfortunately, I am still getting the exact same error. This leaves me at a loss on how to google the issue since everyone else seems to have resolved it by just switching the JRE to a JDK. Does anyone have any thoughts?

Avtar

like image 938
akhalsa Avatar asked Oct 03 '11 17:10

akhalsa


2 Answers

  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. (May have to hit Okay, and re-open 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...

Hopefuly this fixes it...

like image 111
abin babu Avatar answered Oct 05 '22 19:10

abin babu


Try setting Eclipse running in JDK as well — maybe Glassfish picks its JDK. To do this, edit eclipse.ini, and add the line

 -vm 
 path-to-javaw.exe-in-a-JDK

With this configuration, I never had this issue.

like image 36
MaDa Avatar answered Oct 05 '22 17:10

MaDa