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

╄→гoц情女王★ 提交于 2019-12-30 05:50:14

问题


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?


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/6082936/glassfish-in-eclipse-complains-glassfish-v3-requires-a-jdk-1-6-and-not-a-jre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!