简体   繁体   English

蚀中的玻璃鱼似乎看不到我的JDK

[英]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在日食中工作,并遇到JRE vs JDK错误:

GlassFish v3 requires a JDK 1.6 and not a JRE. GlassFish v3需要JDK 1.6而不是JRE。 Please add/select the correct JDK in the Server properties 'Runtime Environment' section. 请在服务器属性“运行时环境”部分中添加/选择正确的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". 当我在glassfish服务器运行时环境上单击“编辑”时,在首选项->服务器->运行时环境中就可以确定,JRE是“默认JRE”。 I clicked the dropdown menu and switched it to my JDK: java-6-openjdk and figured I had the problem solved. 我单击了下拉菜单,并将其切换到我的JDK:java-6-openjdk,发现问题已经解决。 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. 这让我无所适从,因为其他所有人似乎都已通过将JRE切换为JDK来解决了该问题。 Does anyone have any thoughts? 有人有想法吗?

Avtar 阿凡达

  1. make sure the jdk is installed. 确保已安装jdk。 Look in C:\\Program Files\\Java\\jdk1.6.XXXX (mine says 0_16). 查看C:\\Program Files\\Java\\jdk1.6.XXXX (我说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 如果其中包含jdk,则可能已安装,如果没有,您可以从http://java.sun.com/javase/downloads/index.jsp中获取jdk

  2. This is where the error message kinda foobars ya. 这是错误消息有点foobars的地方。

    • Get eclipse started, ignore the message. 开始蚀,忽略消息。
    • Go to Window>Preferences 转到Window>Preferences
    • Then under +Java+Installed JREs hit Add. 然后在+ Java + Installed JREs下,单击Add。
    • Select Standard VM then Next 选择Standard VM然后选择下一步
    • JRE Home = C:\\Program Files\\Java\\jdk1.6.XXXX the rest should fill in automagically. JRE主页= C:\\Program Files\\Java\\jdk1.6.XXXX ,其余的应该自动填写。 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... 单击“偏好设置”窗口中的复选框,返回新的jdk运行时...我不知道为什么需要这样做,但绝对是...
  3. Still in Preference Window. 仍在“首选项”窗口中。 (May have to hit Okay, and re-open Preference window) (可能需要点击确定,然后重新打开“首选项”窗口)

    • Get to +Server, Runtime Environments 前往+ Server,运行时环境
    • Select the Glassfish SRE, hit Edit... 选择Glassfish SRE,点击“编辑...”。
    • From the JRE drop down grab the JDK and hit Finish 从JRE下拉列表中,找到JDK,然后单击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... 右键单击捆绑的Glassfish ...服务器,然后单击重新启动/启动...

Hopefuly this fixes it... 希望这可以解决...

Try setting Eclipse running in JDK as well — maybe Glassfish picks its JDK. 尝试将Eclipse也设置为在JDK中运行-也许Glassfish选择了它的JDK。 To do this, edit eclipse.ini , and add the line 为此,请编辑eclipse.ini并添加该行

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

With this configuration, I never had this issue. 使用此配置,我再也不会遇到这个问题。

Go to Window -> Preferences -> Server -> Runtime Environment. 转到窗口->首选项->服务器->运行时环境。 Select GlassFish xxx click Edit and select the installed JDK in JRE option. 选择GlassFish xxx单击编辑,然后在JRE选项中选择已安装的JDK。 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. 如果在选项中看不到JDK,请转到窗口->首选项->已安装的JRE,然后单击添加...,然后浏览到要添加的JDK文件夹。

simple hit ok when you'll start glassfish from eclipse , as it is asking for username and password . 当您从eclipse启动glassfish时,只需按OK,因为它要求输入用户名和密码。 after 10 times typing my username and password i was still out. 输入我的用户名和密码10次后,我仍然不在。 so , simple hit ok without entering your name and pass 因此,只需单击确定,无需输入您的姓名和密码即可

转到+服务器,运行时环境选择Glassfish SRE,然后单击“编辑...”。从JRE下拉列表中抓取JDK,然后单击“完成”,然后单击“确定”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM