Fedora 17中安装Eclipse

话说在Fedora 17中安装Eclipse的艰辛,非遇到者才知其中滋味。

上周想在Eclipse中配置Android开发环境,一言难尽......

  • 操作系统:Fedora 17(3.5.4-1.fc17.i686)
  • 桌面环境:XFCE4
  • 从官网下载的文件:eclipse-java-helios-SR2-linux-gtk.tar.gz

前后安装了以下版本:

  1. Eclipse 3.5 (Eclipse IDE for Java Developers)
  2. Eclipse Classic 3.7.2
  3. Eclipse 3.6.2(Eclipse IDE for Java Developers)

采用的步骤如下:

1 sudo -i
2 cd /home/z/Downloads/Eclipse-Info
3 tar zxvf eclipse-java-helios-SR2-linux-gtk.tar.gz -C /opt
4 chmod -R +r /opt/eclipse
5 touch /usr/bin/eclipse
6 chmod 755 /usr/bin/eclipse
7 nano -w /usr/bin/eclipse
  粘贴入以下内容:
  export ECLIPSE_HOME="/opt/eclipse"
  $ECLIPSE_HOME/eclipse $*
8 nano /usr/share/applications/eclipse.desktop
  粘贴入以下内容:
  [Desktop Entry]
  Encoding=UTF-8
  Name=Eclipse
  Comment=Eclipse SDK 4.2
  Exec=eclipse
  Icon=/opt/eclipse/icon.xpm
  Terminal=false
  Type=Application
  Categories=GNOME;Application;Development;
  StartupNotify=true

至此Eclipse安装完毕!接下来运行Eclipse就是不断地退出......

在终端中运行出现如下错误提示:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x4224ec0f, pid=3844, tid=3078379200
#
# JRE version: 7.0_07-b10
# Java VM: Java HotSpot(TM) Client VM (23.3-b01 mixed mode, sharing linux-x86 )
# Problematic frame:
# C  [libxul.so+0xda3c0f]  gdk_window_object_get_type+0xda3c0f
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/z/hs_err_pid3844.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/bin/eclipse: 行 2:  3844 已放弃               (吐核)$ECLIPSE_HOME/eclipse $*

每次运行Eclipse每次都“吐”啊~

......

以上省略一万字。

想换操作系统了......

Try again!

以下为删除过程:

1 rm /usr/share/applications/eclipse.desktop
2 rm:是否删除普通文件 "/usr/share/applications/eclipse.desktop"?y
3 rm /usr/bin/eclipse
4 rm:是否删除普通文件 "/usr/bin/eclipse"?y
5 rm -rf /opt/eclipse
后来取消了touch /usr/bin/eclipse步骤。 然后也没有在eclipse里安装theme主题插件(我也不知道会不会和主题有关......)。
现在的方法:
1 sudo -i
2 cd /home/z/Downloads/Eclipse-Info
3 tar zxvf eclipse-java-helios-SR2-linux-gtk.tar.gz -C /opt
4 chmod -R +r /opt/eclipse

再次运行Eclipse还是有自动退出现象!发现和eclipse.ini配置文件有关!安装好后的eclipse.ini内容如下:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.2.R36x_v20101019_1345
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx384m

在最后加入以下2行:

-Dorg.eclipse.swt.browser.UseWebKitGTK=true
-Dorg.eclipse.swt.browser.XULRunnerPath==/usr/lib/xulrunner-2

这下世界清净多了。

问题又来了,由于没有桌面程序图标,在程序菜单里也没有Eclipse的踪影,所以每次启动它都要到它“家里”去找它——/opt/eclipse/eclipse

在终端里每次都要这样:

1 cd /opt/eclipse
2 ./eclipse

几次以后终于怒了。难道没有简单的方法?有!那就是吧eclipse的路径加入环境变量中。

1 vi ~/.bash_profile
2 PATH=$PATH:$HOME/.local/bin:$HOME/bin
3 上面的PATH是没有修改之前的。在后面加上Eclipse的路径,更改后如下:
4 PATH=$PATH:$HOME/.local/bin:$HOME/bin:/opt/eclipse/
5 保存文档退出vi,在终端中输入:
6 source ~/.bash_profile

这样以后在终端中就可以直接输入eclipse来运行程序了。

好像好了。事实并非如此。在bash_profile里的path只会在这个当前的终端中有效,重开一个终端又失效了。

正好九霄在线,我请教了他,他让我在bashrc文件里试试。

vi ~/.bashrc

打开后在文件中加入:

export PATH=$PATH:/opt/eclipse/

OK!天下太平!

posted @ 2012-09-28 22:31  ibg  阅读(1579)  评论(2编辑  收藏  举报