在Linux中哪里可以找到Java SDK ?

时间:2021-03-07 15:06:35

I installed JDK using apt-get install. I dont know where my jdk folder is. I need to set the path for that. Does any one has a clue on the location?

我使用apt-get安装安装JDK。我不知道我的jdk文件夹在哪里。我需要为它设置路径。有人知道地点吗?

10 个解决方案

#1


287  

This depends a bit from your package system ... if the java command works, you can type readlink -f $(which java) to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java (but this is not a system which uses apt-get).

这取决于你的软件包系统……如果java命令有效,您可以输入readlink -f $(哪个java)来查找java命令的位置。在我现在使用的OpenSUSE系统上,它返回/usr/lib64/jvm/java-1.6 -openjdk-1.6.0/jre/bin/java(但这不是一个使用apt-get的系统)。


On Ubuntu, it looks like it is in /usr/lib/jvm/java-6-openjdk/ for OpenJDK, and in some other subdirectory of /usr/lib/jvm/ for Suns JDK (and other implementations as well, I think).

在Ubuntu上,它看起来像是在/usr/lib/jvm/java-6- OpenJDK /中,在/usr/lib/jvm/的其他子目录中(我认为还有其他实现)。

Debian is the same.

Debian是相同的。


For any given package you can determine what files it installs and where it installs them by querying dpkg. For example for the package 'openjdk-6-jdk': dpkg -L openjdk-6-jdk

对于任何给定的包,您都可以通过查询dpkg来确定它安装了哪些文件以及在何处安装它们。例如“openjdk-6-jdk”包:dpkg -L openjdk-6-jdk

#2


35  

update-java-alternatives -l

will tell you which java implementation is the default for your system and where in the filesystem it is installed. Check the manual for more options.

将告诉您哪些java实现是系统的默认实现,以及系统在文件系统中的何处安装。查看手册以获得更多选项。

#3


27  

$ which java 

should give you something like

应该给你一些类似的东西吗

/usr/bin/java

#4


11  

This question will get moved but you can do the following

这个问题会被转移,但是你可以做以下的事情

which javac

or

cd /
find . -name 'javac'

#5


6  

Another best way to find Java folder path is to use alternatives command in Fedora Linux (I know its for Ubuntu but I hit this post from google just by its headline). Just want to share incase people like me looking for answers for fedora flavour.

另一种找到Java文件夹路径的最佳方法是在Fedora Linux中使用替代命令(我知道它是Ubuntu的,但是我从谷歌的标题中找到了这篇文章)。我只是想和大家分享一些关于fedora口味的问题。

To display all information regarding java

显示有关java的所有信息

alternatives --display java

#6


6  

Use find to located it. It should be under /usr somewhere:

使用find来定位它。它应该在/usr以下的某个地方:

find /usr -name java

When running the command, if there are too many "Permission denied" message obfuscating the actual found results then, simply redirect stderr to /dev/null

运行该命令时,如果有太多“拒绝权限”消息混淆了实际发现的结果,只需将stderr重定向到/dev/null即可

find /usr -name java 2> /dev/null

#7


2  

Simple, try it:

简单,试一试:

It's /usr/local/java/jdk[version]

这是/usr/local/java/jdk(版本)

#8


1  

the command: sudo update-alternatives --config java will find the complete path of all installed Java versions

命令:sudo update-alternatives——config java将找到所有已安装java版本的完整路径

#9


1  

Three Step Process: First: open Terminal->$ whereis java it would give output like this: java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz

三个步骤的过程:第一步:打开终端->$其中的java是:java: /usr/bin/java /usr/ share/usr / share/man1 /java.1.gz

Second: ls -l /usr/bin/java It would give output like this: lrwxrwxrwx 1 root root 22 Feb 9 10:59 /usr/bin/java -> /etc/alternatives/java

第二:ls -l /usr/bin/java输出如下:lrwxrwxrwxrwx 1根2月9日10:59 /usr/bin/java -> /etc/alternative /java

Third: ls -l /etc/alternatives/java output is the JDK path: lrwxrwxrwx 1 root root 46 Feb 9 10:59 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

第三:ls -l /etc/alternative /java输出是JDK路径:lrwxrwxrwxrwxrwxrwx 1根根,2月9日10:59 /etc/alternatives/java -> /usr/ lib/jvm/jvm -8-openjdk-amd64/jre/bin/java

#10


0  

on OpenSUSE 13.1/13.2 its: /usr/lib64/jvm/java-1.6.0-openjdk-(version-number)
version-number can be 1.7.x 1.8.x etc. check software manager witch version you have installed...

对于OpenSUSE 13.1/13.2,它的:/usr/lib64/jvm/java-1.6 -openjdk-(版本号)版本号可以是1.7。1.8 x。检查你安装的软件管理员版本……

André

安德烈

#1


287  

This depends a bit from your package system ... if the java command works, you can type readlink -f $(which java) to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java (but this is not a system which uses apt-get).

这取决于你的软件包系统……如果java命令有效,您可以输入readlink -f $(哪个java)来查找java命令的位置。在我现在使用的OpenSUSE系统上,它返回/usr/lib64/jvm/java-1.6 -openjdk-1.6.0/jre/bin/java(但这不是一个使用apt-get的系统)。


On Ubuntu, it looks like it is in /usr/lib/jvm/java-6-openjdk/ for OpenJDK, and in some other subdirectory of /usr/lib/jvm/ for Suns JDK (and other implementations as well, I think).

在Ubuntu上,它看起来像是在/usr/lib/jvm/java-6- OpenJDK /中,在/usr/lib/jvm/的其他子目录中(我认为还有其他实现)。

Debian is the same.

Debian是相同的。


For any given package you can determine what files it installs and where it installs them by querying dpkg. For example for the package 'openjdk-6-jdk': dpkg -L openjdk-6-jdk

对于任何给定的包,您都可以通过查询dpkg来确定它安装了哪些文件以及在何处安装它们。例如“openjdk-6-jdk”包:dpkg -L openjdk-6-jdk

#2


35  

update-java-alternatives -l

will tell you which java implementation is the default for your system and where in the filesystem it is installed. Check the manual for more options.

将告诉您哪些java实现是系统的默认实现,以及系统在文件系统中的何处安装。查看手册以获得更多选项。

#3


27  

$ which java 

should give you something like

应该给你一些类似的东西吗

/usr/bin/java

#4


11  

This question will get moved but you can do the following

这个问题会被转移,但是你可以做以下的事情

which javac

or

cd /
find . -name 'javac'

#5


6  

Another best way to find Java folder path is to use alternatives command in Fedora Linux (I know its for Ubuntu but I hit this post from google just by its headline). Just want to share incase people like me looking for answers for fedora flavour.

另一种找到Java文件夹路径的最佳方法是在Fedora Linux中使用替代命令(我知道它是Ubuntu的,但是我从谷歌的标题中找到了这篇文章)。我只是想和大家分享一些关于fedora口味的问题。

To display all information regarding java

显示有关java的所有信息

alternatives --display java

#6


6  

Use find to located it. It should be under /usr somewhere:

使用find来定位它。它应该在/usr以下的某个地方:

find /usr -name java

When running the command, if there are too many "Permission denied" message obfuscating the actual found results then, simply redirect stderr to /dev/null

运行该命令时,如果有太多“拒绝权限”消息混淆了实际发现的结果,只需将stderr重定向到/dev/null即可

find /usr -name java 2> /dev/null

#7


2  

Simple, try it:

简单,试一试:

It's /usr/local/java/jdk[version]

这是/usr/local/java/jdk(版本)

#8


1  

the command: sudo update-alternatives --config java will find the complete path of all installed Java versions

命令:sudo update-alternatives——config java将找到所有已安装java版本的完整路径

#9


1  

Three Step Process: First: open Terminal->$ whereis java it would give output like this: java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz

三个步骤的过程:第一步:打开终端->$其中的java是:java: /usr/bin/java /usr/ share/usr / share/man1 /java.1.gz

Second: ls -l /usr/bin/java It would give output like this: lrwxrwxrwx 1 root root 22 Feb 9 10:59 /usr/bin/java -> /etc/alternatives/java

第二:ls -l /usr/bin/java输出如下:lrwxrwxrwxrwx 1根2月9日10:59 /usr/bin/java -> /etc/alternative /java

Third: ls -l /etc/alternatives/java output is the JDK path: lrwxrwxrwx 1 root root 46 Feb 9 10:59 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

第三:ls -l /etc/alternative /java输出是JDK路径:lrwxrwxrwxrwxrwxrwx 1根根,2月9日10:59 /etc/alternatives/java -> /usr/ lib/jvm/jvm -8-openjdk-amd64/jre/bin/java

#10


0  

on OpenSUSE 13.1/13.2 its: /usr/lib64/jvm/java-1.6.0-openjdk-(version-number)
version-number can be 1.7.x 1.8.x etc. check software manager witch version you have installed...

对于OpenSUSE 13.1/13.2,它的:/usr/lib64/jvm/java-1.6 -openjdk-(版本号)版本号可以是1.7。1.8 x。检查你安装的软件管理员版本……

André

安德烈