eclipse 中的 glassfish 似乎没有看到我的 JDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7638748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
glassfish in eclipse doesn't seem to see my JDK
提问by akhalsa
I am trying to get glassfish working in eclipse, and running into the JRE vs JDK error:
我试图让 glassfish 在 Eclipse 中工作,并遇到 JRE vs JDK 错误:
GlassFish v3 requires a JDK 1.6 and not a JRE. Please add/select the correct JDK in the Server properties 'Runtime Environment' section.
GlassFish v3 需要 JDK 1.6 而不是 JRE。请在服务器属性“运行时环境”部分添加/选择正确的 JDK。
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?
我用谷歌搜索,似乎很多人都有这个问题。果然在首选项-> 服务器-> 运行时环境中,当我在 glassfish 服务器运行时环境上单击编辑时,JRE 是“默认 JRE”。我单击下拉菜单并将其切换到我的 JDK:java-6-openjdk 并认为我已经解决了问题。不幸的是,我仍然收到完全相同的错误。这让我不知道如何用谷歌搜索这个问题,因为其他人似乎都通过将 JRE 切换到 JDK 来解决它。有人有想法吗?
Avtar
头像
采纳答案by MaDa
Try setting Eclipse running in JDK as well — maybe Glassfish picks its JDK. To do this, edit eclipse.ini, and add the line
也尝试将 Eclipse 设置为在 JDK 中运行——也许 Glassfish 选择了它的 JDK。为此,请编辑eclipse.ini并添加行
-vm
path-to-javaw.exe-in-a-JDK
With this configuration, I never had this issue.
有了这个配置,我从来没有遇到过这个问题。
回答by abin babu
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.jspThis 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 VMthen Next - JRE Home =
C:\Program Files\Java\jdk1.6.XXXXthe 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...
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.
Go to the Servers Veiw (probably down by the Console View). Right click on the Bundled Glassfish...Server and hit restart/start...
确保安装了 jdk。查看
C:\Program Files\Java\jdk1.6.XXXX(我的说是 0_16)。如果里面有东西,jdk 可能已经安装,如果没有,你可以从http://java.sun.com/javase/downloads/index.jsp获取 jdk这是错误消息有点 foobars 的地方。
- 启动 eclipse,忽略该消息。
- 去
Window>Preferences - 然后在 +Java+Installed JREs 下点击 Add。
- 选择
Standard VM然后Next - JRE Home =
C:\Program Files\Java\jdk1.6.XXXX其余部分应自动填写。点击完成。 - 最重要的!单击新 jdk 运行时的首选项窗口中的复选框......我不知道为什么它是必要的,但它绝对是......
仍在首选项窗口中。(可能需要点击 OK,然后重新打开 Preference 窗口)
- 访问 +Server、运行时环境
- 选择 Glassfish SRE,点击编辑...
- 从 JRE 下拉菜单中获取 JDK 并点击 Finish
- 打好。
转到服务器视图(可能在控制台视图旁边)。右键单击 Bundled Glassfish...Server 并点击重新启动/启动...
Hopefuly this fixes it...
希望这能解决它...
回答by mik
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.
转到窗口 -> 首选项 -> 服务器 -> 运行时环境。选择 GlassFish xxx 单击 Edit 并选择已安装的 JDK in JRE 选项。如果在选项中看不到 JDK,请转到 Window -> Preferences -> installed JREs 并单击 Add... 并浏览到要添加的 JDK 文件夹。
回答by mamuka
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
当您从 eclipse 启动 glassfish 时,简单点击 ok ,因为它要求输入用户名和密码。输入我的用户名和密码 10 次后,我仍然不在。所以,简单点击确定,无需输入您的姓名并通过
回答by Xyz
Get to +Server, Runtime Environments Select the Glassfish SRE, hit Edit... From the JRE drop down grab the JDK and hit Finish Hit Okay.Worked well for me
进入 +Server, Runtime Environments 选择 Glassfish SRE,点击 Edit... 从 JRE 下拉菜单中获取 JDK 并点击 Finish Hit Okay。对我来说效果很好

