Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commands for the Linux system to view the java installation directory

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will introduce in detail for you the "Linux system to view the java installation directory commands which", the contents of the steps are clear and detailed, the details are properly handled, and the editor will update different knowledge points every day, hope that this "Linux system to view the java installation directory command which" can give you unexpected harvest, please follow the editor's ideas slowly in-depth, the specific contents are as follows, to harvest new knowledge together.

Before obtaining the java installation path, you should determine whether java has been successfully installed.

Execute the command:

Java Usage: java [- options] class [args...] (to execute a class) or java [- options]-jar jarfile [args...] (to execute a jar file) where options include:-D32 use a 32-bit data model if available-D64 use a 64-bit data model if available-server to select the "server" VM The default VM is server. -cp-classpath A: separated list of directories, JAR archives, and ZIP archives to search for class files. -D =. Before viewing the java version:

Java-version [root@localhost Desktop] # java-version openjdk version "1.8.0 to 65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode) you can query the installation path if the above two steps are all right

If JAVA_HOME is configured in the / etc/profile file, you can get it directly:

Echo $JAVA_HOME [root@localhost local] # echo $JAVA_HOME / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/jre/bin/java if the above method cannot be queried, use the following:

[root@localhost local] # which java / usr/bin/java [root@localhost local] # ls-lrt / usr/bin/java lrwxrwxrwx. 1 root root 22 Mar 7 19:12 / usr/bin/java-> / etc/alternatives/java [root@localhost local] # ls-lrt / etc/alternatives/java lrwxrwxrwx. 1 root root 70 Mar 7 19:12 / etc/alternatives/java-> / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/jre/bin/java then edit the / etc/profile file, adding at the end of the file

Vi / etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/jre/bin/java export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar Save Command Settings

Source / etc/profile is executing the view command:

[root@localhost local] # echo $JAVA_HOME / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-what are the versions of Linux: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu, etc. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.

Thank you for reading this. The editor hopes that you will have the most profound experience from the practical level on the key issue of "what are the commands for Linux system to view the java installation directory?". The specific use also requires everyone to practice and use it before you can understand it. If you want to read more related articles, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report