How do I specify the JDK for a GlassFish domain?

前端 未结 9 2067
一生所求
一生所求 2020-11-28 08:02

I\'ve got GlassFish 2.1.1 installed. I have a 1.5 and a 1.6 JDK installed. Even though my JAVA_HOME variable is set to the 1.5 version (and both \"java -version\" and \"java

相关标签:
9条回答
  • 2020-11-28 08:25

    Had the same problem in my IntelliJ 17 after adding fresh glassfish 4.1.

    I had set my JAVA_HOME environment variable as follow:

    echo %JAVA_HOME%
    C:\Java\jdk1.8.0_121\
    

    Then opened %GLASSFISH_HOME%\glassfish\config\asenv.bat

    And just added and the end of the file:

    set AS_JAVA=%JAVA_HOME%

    Then Glassfish started without problems.

    0 讨论(0)
  • 2020-11-28 08:26

    Similar error with Glassfish 4.0 and several JDK installed:

    SEVERE: GlassFish requires JDK 7, you are using JDK version 6.
    

    There is no AS_JAVA reference in "C:\glassfish\config\asenv.bat" by default. After adding manually

    set AS_JAVA=C:\Program Files\Java\jdk1.7.0_25 
    

    it works.

    0 讨论(0)
  • 2020-11-28 08:28

    In my case the problem was the JAVA_HOME variable was set an installed jre.

    An alternative to setting the AS_JAVA variable is to set JAVA_HOME environment variable to the jdk (i.e. /usr/local/jdk1.7.0.51).

    0 讨论(0)
  • 2020-11-28 08:30

    Adding the actual content from dbf's link in order to keep the solution within stackoverflow.

    It turns out that when I first installed Glassfish on my Windows system I had JDK 6 installed, and recently I had to downgrade to JDK 5 to compile some code for another project.

    Apparently when Glassfish is installed it hard-codes its reference to your JDK location, so to fix this problem I ended up having to edit a file named asenv.bat. In short, I edited this file:

    C:\glassfish\config\asenv.bat:
    

    and I commented out the reference to JDK 6 and added a new reference to JDK 5, like this:

    REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/..
    set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16
    

    Although the path doesn't appear to be case sensitive, I've spent hours debugging an issue around JMS Destination object not found due to my replacement path's case being incorrect.

    0 讨论(0)
  • 2020-11-28 08:31

    According to the GF Administration Guide:

    For a valid JVM installation, locations are checked in the following order: a. domain.xml (java-home inside java-config) b. asenv.conf (setting AS_JAVA="path to java home")

    I had to add both these settings to make it work. Otherwise 'asadmin stop-domain domain1' wouldn't work. I guess that GF uses a. and asadmin uses b.

    (On Windows: b. asenv.bat)

    0 讨论(0)
  • 2020-11-28 08:33

    In Linux file system , Edit below file as this steps

    Path - /opt/glassfish3/glassfish/config

    File Name - asenv.conf

    Add the JAVA HOME path as below to the end of file.

    AS_JAVA=/opt/jdk1.8.0_201

    Now start the glassfish server.

    0 讨论(0)
提交回复
热议问题