Before installing eclipse, you must first install the JDK,
1. Install JDK
1. Download the JDK from the official website.
Link: https://www.oracle.com/java/technologies/downloads/
The selected jdk file is generally the x64 Compressed Archive version in linnux.
2. Enter in the terminal: sudo mkdir /usr/lib/jvm
to create a folder jvm in the /usr/lib directory
3. Enter in the terminal: sudo tar -xzvf /home/test/java-jdk/jdk-17_linux-x64_bin. tar.gz -C /usr/lib/jvm
where /home/test/java-jdk/ is the path where the file jdk-17_linux-x64_bin.tar.gz downloaded in the first step is located; -C should not be less, otherwise the command may Delivery failed; /usr/lib/jvm is the decompression path of jdk-17_linux-x64_bin.tar.gz
4. Enter in the terminal: sudo gedit /etc/profile
to open the profile file
5. Add the following at the end of the profile file OK:
fi //这一行是profile文件的最后一行,在这一行后面加入下方的几行,行与行之间插入一个空行,内容最好手动输入,以免复制进去出现一些意想不到的错误,注释不要加进去。
export JAVA_HOME=/usr/lib/jvm/jdk-17.0.1 //jdk-17.0.1是jvm文件夹内的一个文件夹,按照自己的实际情况修改
export HRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Once entered, save and close.
6. Enter in the terminal: source ~/.bashrc
to make the environment take effect
7. Enter in the terminal: echo $JAVA_HOME
to determine whether the JDK takes effect
8. Enter in the terminal: java -version
to check whether java is installed successfully.
Two, install eclipse
1. Download eclipse
link from the official website: https://www.eclipse.org/downloads/packages/
Version selection: Eclipse IDE for C/C++ Developers, Linux x86_64 (Based on your own needs, C/C++ is suitable for this, specific reference link: https://www.cnblogs.com/chenmingjun/p/8404628.html)
to download, do not click download directly, first choose to change to another mirror (>> Select Another Mirror), choose any address in inland China to download it will be faster .
2. Enter in the terminal: mkdir /opt/eclipse
3. Enter in the terminal: sudo tar -xzvf /home/test/java-jdk/eclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz - C /opt/eclipse/
where: /home/test/java-jdk/ is the path where the downloaded eclipse installation package eclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz is located, /opt/ is the unzipped path.
4. Add a desktop shortcut:
Enter in the terminal: cd /usr/share/applications/
Enter in the terminal: ls
to check whether there is: eclipse.desktop file, if not, enter in the terminal: cp xxx.desktop eclipse.desktop, if there is Skip this step; the command line must be entered after entering cd /usr/share/applications/, where xxx is the file name, and any existing file can be found and copied
Enter in the terminal: sudo gedit eclipse.desktop to open the eclipse.desktop file.
In the opened eclipse.desktop file, modify it. The modified content is as follows:
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse
Exec=/opt/eclipse/eclipse //前面的/opt/eclipse/是解压路径,后面的eclipse 是解压后文件夹内存放的一个文件的文件名
Icon=/opt/eclipse/icon.xpm//前面的/opt/eclipse/是解压路径,后面的icon.xpm是解压后文件夹内存放的一个文件的文件名
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;
注:把列出项等号后面的内容修改为上面的内容即可,未列出的可以保留,以可以删除,//后的内容为注释,不要添加
After the modification is complete, save and close the file.
5. After finding the eclipse icon in the display application, open it, there seems to be a prompt, forget what it is, probably whether to trust the path or not, just click trust
The above is the complete installation process. If you encounter a prompt saying that the permissions are not enough, you can enter: su root to enter root and operate under root.
If it is the first time to enter root, you need to set the password to enter root first.