问题描述
我知道它已安装,因为当我输入时:
I know it's installed because when I type:
$java -version
我得到:
OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
当我输入:
$locate jdk
我得到:
/home/arturo/Documents/2012a/sys/java/jre/glnxa64/jre/lib/servicetag/jdk_header.png
/usr/share/app-install/desktop/openjdk-6-jre:openjdk-6-java.desktop
/usr/share/app-install/desktop/openjdk-7-jre:openjdk-7-java.desktop
/usr/share/app-install/icons/openjdk-6.png
/usr/share/app-install/icons/openjdk-7.png
令我担心的是列表中的第一项是2012a文件夹是我的MATLAB文件夹而不是标准的'usr / lib'文件夹。我真的很困惑JDK和JRE的安装位置,因为我需要设置指向该文件夹的$ JAVA_HOME路径。我在哪里遗漏了什么?
What worries me about the first item in the list is that the 2012a folder is my MATLAB folder and not a standard 'usr/lib' folder. I'm really confused on where the JDK and JRE got installed, because I need to set the $JAVA_HOME path pointing to the folder. Where am I missing something?
推荐答案
下面的命令将为您提供路径但它只有在java命令工作时才会起作用,换句话说,如果java路径是构造。
Below command will give you the path, But it will only work if java command is working in other words if java path is configured.
readlink -f $(which java)
更多信息,请访问
您需要深入了解符号链接。以下是获取Java目录的步骤
You need to dig into symbolic links. Below is steps to get Java directory
步骤1:
$ whereis java
java: /usr/bin/java /etc/java /usr/share/java
告诉命令java驻留在/ usr / bin / java。
That tells the command java resides in /usr/bin/java.
再次挖掘:
第2步:
$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2009-01-15 18:34 /usr/bin/java -> /etc/alternatives/java
所以,现在我们知道 / usr / bin / java
实际上是 / etc / alternatives / java
的符号链接。
So, now we know that /usr/bin/java
is actually a symbolic link to /etc/alternatives/java
.
使用上述相同的方法深入挖掘:
Dig deeper using the same method above:
第3步:
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 31 2009-01-15 18:34 /etc/alternatives/java -> /usr/local/jre1.6.0_07/bin/java
那就是java的实际位置: / usr / local / jre .....
So, thats the actual location of java: /usr/local/jre.....
您仍然可以深入挖掘其他符号链接。
You could still dig deeper to find other symbolic links.
参考:
这篇关于我的计算机中的Java SDK文件夹在哪里? Ubuntu 12.04的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!