Ubuntu 18 install eclipse

##Resources ready to
download JDK
selection to dk-8u172-linux-x64.tar.gz
download Eclipse
selectionEclipse IDE for Java Developers linux-64bit

##Install JDK
Unzip the JDK to a directory under root user authority. You /opt/jvmneed to switch to the root user
command . Create a new folder command
su
in the directory. Unzip the downloaded jdk tar file to the directory. The downloaded file should be under, and you need to move the file to Under contents. Order/opt

mkdir jvm
/opt/jvm
/home/{username}/download/opt/jvm

mv -f /home/{username}/download/jdk-8u172-linux-x64.tar.gz /opt/jvm/
tar -xzf tar -xzf jdk-8u172-linux-x64.tar.gz

##Configure JDK environment variables

User profile path vim /etc/profileto open the file.
Add the following statement at the end of the file to configure the path, noting the blank lines between each line:

export JAVA_HOME=/opt/jvm/jdk1.8.0_172

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

save document.

Enter the command: source /etc/profile
check whether the installation is successful, enter: java -version
if the following appears, it is successful:

root@joyce:/opt/jvm/jdk1.8.0_172# java -version
java version “1.8.0_172”
Java™ SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot™ 64-Bit Server VM (build 25.172-b11, mixed mode)


Explain the use of the source command [refer to Baidu know]
The function of source FileName
: Read and execute the commands in FileName in the current bash environment.
Note: This command is usually replaced with the command ".".
Such as: source .bash_rc is equivalent to . .bash_rc.
Note: The difference between the source command and shell scripts is that
source executes the command in the current bash environment, while scripts start a subshell to execute the command. In this way, if the command for setting environment variables (or alias, etc.) is written into scripts, it will only affect the subshell and cannot change the current BASH. Therefore, when setting environment variables through a file (command line), use the source command.

##Install Eclipse
(note that I always operate under the root user, if it is a normal user, you need to add sudo before the command)
Move Eclipse to the opt directory, decompress the current directory
command
mv /home/joyce/download/eclipse-java-oxygen-3a-linux-gtk-x86_64.tar.gz /opt
tar xzvf eclipse-java-oxygen-3a-linux-gtk-x86_64.tar.gz
###Create a desktop shortcut icon
cd /usr/share/applications/
vim eclipse.desktop(root permission)
A new eclipse.desktopfile will be created at this time, and the following statement will be added to the file:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;

After decompressing the tar file downloaded by eclipse, there are two executable files in the folder. The suffix is ​​marked with *, which is the executable file. It Exec=is the location path of the eclipse program in the eclipse installation directory, and Icon=it is the icon icon file in the installation directory. .
After saving, the file becomes executable.
Order
sudo chmod u+x eclipse.desktop

###Move the icon to the desktop
Note : When moving the icon file to the desktop folder, it should be operated by ordinary users, otherwise it will prompt "Untrusted application launcher problem".
Movement can be dragged.

Double-click Eclipse, select Turst and Launch and you're done!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326303394&siteId=291194637