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 [[email protected] ~]# 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 [[email protected] ~]# source /etc/profile 8 9 [[email protected] ~]# 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 [[email protected] ~]# vim /etc/ssh/sshd_config #编辑如下 2 X11Forwarding yes 3 4 [[email protected] ~]# service sshd restart 5 6 [[email protected] ~]# yum -y install xorg-x11-xauth 7 [[email protected] ~]# export DISPLAY=localhost:10.0
4、Xshell开启X11转发
5、测试X11是否接通
1 [[email protected] ~]# yum -y install xclock 2 [[email protected] ~]# xclock
正常情况下可以看到如下的时钟界面,如果报错则重启虚拟机和Xshell重试
6、启动eclipse
1 [[email protected] ~]# cd /datas/soft/eclipse 2 [[email protected] eclipse]# ./eclipse 3 Eclipse: 4 An error has occurred. See the log file 5 /datas/soft/eclipse/configuration/1500009184940.log. 6 [[email protected] 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 [[email protected] eclipse]# yum -y install gtk+* 14 [[email protected] eclipse]# ./eclipse 15 (<unknown>:2334): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type=‘PangoRenderFc‘, script=‘latin‘ 16 [[email protected] eclipse]# yum -y install xorg-x11-fonts-Type1 17 [[email protected] eclipse]# ./eclipse #出现图像界面了,报错如下
1 [[email protected] 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 [[email protected] eclipse]# yum -y install libXtst 9 [[email protected] eclipse]# ./eclipse #成功启动
时间: 2024-11-04 13:22:15