Reputation: 3805
I've got machine which is using 2 versions of java(for eg. 6-th and 7-th). If I will run java -version
, the system will say it's 6-th. Is there an approach to set another java version for JBoss only?
Upvotes: 15
Views: 51127
Reputation: 91
Standalone
server or localdev
, change file standalone.conf
domain control
, change file domain.conf
in $JBOSS_HOME/bin
#JAVA_HOME="/opt/java/jdk" → JAVA_HOME="/path/to/jdk"
#JAVA="" → JAVA="$JAVA_HOME/bin/java"
Upvotes: 9
Reputation: 12592
For Window
users @ColithaWa's
answer works
Just edit your JAVA_HOME
key in the jboss/bin/standalone.config
and set it to your wherever your new jdk resides.
Upvotes: 0
Reputation: 999
i am using linux and JBoss 7.1.0.
i have both JDK 7 and 8. Version 8 is system default JDK so JBoss 7.1 does not not run on JDK 8. I had to use JDK 7.
i installed JDK 7 in the "/opt/" directory.
Make sure you know the path to your JDK Home, and replace my JDK home with yours.
Follow these steps:
Open the "Standalone.conf" file found in your JBoss "bin" folder in a text editor.
Locate the section below:
# Specify the location of the Java home directory. If set then $JAVA will
# be defined to $JAVA_HOME/bin/java, else $JAVA will be "java".
#
#JAVA_HOME="/opt/java/jdk"
Edit the last line in the segment above to:
JAVA_HOME="/opt/jdk1.7.0_79/"
Save the standalone.conf file. YOu are good to go
Upvotes: 0
Reputation: 61
If you start the jboss from standalone.bat (for .sh find the simmilar lines) you can comment the following lines
if "x%JAVA_HOME%" == "x" (
set JAVA=java
echo JAVA_HOME is not set. Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
) else (
set "JAVA=%JAVA_HOME%\bin\java"
)
and add
set "JAVA=<path to the desired jdk>\bin\java"
That worked for me :)
Upvotes: 5
Reputation: 2208
To Select alternatives for java
As root, type the following command at the shell prompt and you should see something like this:
[root@vsr ~]$ /usr/sbin/alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.5.0-sun/bin/java
Enter to keep the current selection[+], or type selection number:
please refer this link for more detail
Upvotes: -2