问题
I have jdk1.7.0 directory in /usr/lib/jvm along with other open-jdk versions. I want my Ubuntu 12.04 to treat this jdk(jdk1.7.0) as its primary jdk i.e. I dont want to use open-jdks.
When I type java -version or javac -version, both the times it returns that it is using openjdk and its jre. How can change it to jdk1.7.0?
回答1:
Put something similar to following to your ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/jdk1.7.0"
export PATH="$JAVA_HOME/bin:$PATH"
for loading the changes, you can just run new bash by typing "bash" :]
回答2:
Change the PATH variable so that /usr/lib/jvm
is listed before the directory which contains Open JDK. If you are using bash, you can do this in the .bashrc
file in your home directory.
来源:https://stackoverflow.com/questions/13851621/switch-from-open-jdk-to-sun-jdk