Linux虚拟机里用X11协议打开图形界面的eclipse

Posted andyChan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux虚拟机里用X11协议打开图形界面的eclipse相关的知识,希望对你有一定的参考价值。

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 #成功启动

 

 

以上是关于Linux虚拟机里用X11协议打开图形界面的eclipse的主要内容,如果未能解决你的问题,请参考以下文章

linux虚拟机突然打不开,呈现如下界面???求解

配置Termux官方X11图形界面

linux 下面X11库是干啥的

虚拟机里怎么开始linux系统,打startx命令提示错误

刚接触Linux ,在虚拟机里用bind搭建DNS服务器,安装了chroot环境。 named.conf文件配置好了,

我在虚拟机上装了Linux,结果不能进入图形界面