glassfish in eclipse doesn't seem to see my JDK

16,983

Solution 1

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.

Solution 2

  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...

Solution 3

Go to Window -> Preferences -> Server -> Runtime Environment. Select GlassFish x.x.x click Edit and select the installed JDK in JRE option. If you couldn't see JDK in the options, goto Window -> Preferences -> installed JREs and click Add... and browse to JDK folder you want to add.

Solution 4

simple hit ok when you'll start glassfish from eclipse , as it is asking for username and password . after 10 times typing my username and password i was still out. so , simple hit ok without entering your name and pass

Share:
16,983
akhalsa
Author by

akhalsa

Updated on June 19, 2022

Comments

  • akhalsa
    akhalsa almost 2 years

    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

  • akhalsa
    akhalsa over 12 years
    I have my jdk in the directory: /usr/lib/jvm/java-6-openjdk which contains the bin folder which has the java and the javaws files (although no javaw... perhaps that is the problem?) I tried setting the flag in the eclipse.ini file both as /usr/lib/jvm/java-6-openjdk and /usr/lib/jvm/java-6-openjdk/bin and neither one worked.
  • MaDa
    MaDa over 12 years
    @user659874 See my edited answer. The "-vm" and the path must be in separate lines, otherwise they don't work.
  • akhalsa
    akhalsa over 12 years
    Thank you for the reply. Do you know if I need the path to include bin or not?
  • akhalsa
    akhalsa over 12 years
    Thank you for the help. Unfortunately neither directory worked. My eclipse.ini file looks like this: -vm /usr/lib/jvm/java-6-openjdk/ and I am getting the same result
  • MaDa
    MaDa over 12 years
    @user659874 Ooops, sorry for my Windowish example. Eclipsepedia says in Linux you must provide a full path to java executable, so in your example it would probably be /usr/lib/jvm/java-6-openjdk/bin/java.
  • akhalsa
    akhalsa over 12 years
    It seems that I was mistaken before. The error seemed to in fact come from using the version of java that came with my eclipse download. I just did apt-get to download the latest JRE and JDK's pointed glassfish at them, and it worked
  • MaDa
    MaDa over 12 years
    @user659874 Feel free to share your Linux configuration with the -vm option - add another answer perhaps. I'd gladly see it and upvote.
  • Arjan
    Arjan over 12 years
    You really should be able to set a specific JDK for GlassFish, when started from Eclipse, though apparently that did not work for the OP. See GlassFish in Eclipse complains “GlassFish v3 requires a JDK 1.6 and not a JRE”.
  • Admin
    Admin over 10 years
    Even though all my environment variables were set, I first had to do this in order to get it to work. (Just in case someone wonders oneday)
  • user359519
    user359519 about 10 years
    This fixed the problem for me - quick and easy. Voted up.
  • Mysterion
    Mysterion about 9 years
    could you be more specific? more details?