1、下載工具包
XLaunch(安裝到win)
https://xming.en.softonic.com/
Eclipse IDE for C/C++ Developers(虛擬機里解壓到 /datas/soft/eclipse)
https://www.eclipse.org/downloads/eclipse-packages/?osType=linux&release=undefined
jdk(虛擬機里解壓到 /usr/jdk1.8.0_131)
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、配置jdk環境變量
1 [root@localhost ~]# vim /etc/profile #編輯如下 2 JAVA_HOME=/usr/jdk1.8.0_131 3 CLASSPATH=.:$JAVA_HOME/lib/tools.jar 4 PATH=$JAVA_HOME/bin:$PATH 5 export JAVA_HOME CLASSPATH PATH 6 7 [root@localhost ~]# source /etc/profile 8 9 [root@localhost ~]# java -version 10 java version "1.8.0_131" 11 Java(TM) SE Runtime Environment (build 1.8.0_131-b11) 12 Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
3、開啟X11支持
1 [root@localhost ~]# vim /etc/ssh/sshd_config #編輯如下 2 X11Forwarding yes 3 4 [root@localhost ~]# service sshd restart 5 6 [root@localhost ~]# yum -y install xorg-x11-xauth 7 [root@localhost ~]# export DISPLAY=localhost:10.0
4、Xshell開啟X11轉發
5、開啟XLaunch(一直下一步)
6、測試X11是否接通
1 [root@localhost ~]# yum -y install xclock 2 [root@localhost ~]# xclock
正常情況下可以看到如下的時鍾界面,如果報錯則重啟虛擬機和Xshell重試
7、啟動eclipse
1 [root@localhost ~]# cd /datas/soft/eclipse 2 [root@localhost eclipse]# ./eclipse 3 Eclipse: 4 An error has occurred. See the log file 5 /datas/soft/eclipse/configuration/1500009184940.log. 6 [root@localhost eclipse]# cat /datas/soft/eclipse/configuration/1500009184940.log 7 #錯誤片段 8 java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 9 /datas/soft/eclipse/configuration/org.eclipse.osgi/429/0/.cp/libswt-pi-gtk-4629.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory 10 no swt-pi-gtk in java.library.path 11 /root/.swt/lib/linux/x86_64/libswt-pi-gtk-4629.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory 12 Can't load library: /root/.swt/lib/linux/x86_64/libswt-pi-gtk.so 13 [root@localhost eclipse]# yum -y install gtk+* 14 [root@localhost eclipse]# ./eclipse 15 (<unknown>:2334): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin' 16 [root@localhost eclipse]# yum -y install xorg-x11-fonts-Type1 17 [root@localhost eclipse]# ./eclipse #出現圖像界面了,報錯如下
1 [root@localhost eclipse]# cat /datas/soft/eclipse/configuration/1500009612543.log 2 #錯誤片段 3 java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 4 /datas/soft/eclipse/configuration/org.eclipse.osgi/429/0/.cp/libswt-pi-gtk-4629.so: libXtst.so.6: cannot open shared object file: No such file or directory 5 no swt-pi-gtk in java.library.path 6 /root/.swt/lib/linux/x86_64/libswt-pi-gtk-4629.so: libXtst.so.6: cannot open shared object file: No such file or directory 7 Can't load library: /root/.swt/lib/linux/x86_64/libswt-pi-gtk.so 8 [root@localhost eclipse]# yum -y install libXtst 9 [root@localhost eclipse]# ./eclipse #成功啟動