【已解决】Ubuntu中双击Eclipse结果出错:A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse

【问题】

折腾:

【记录】Ubuntu中下载和安装Eclipse

期间,结果找不到java而出错:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse
No Java virtual machine was found after searching the following locations:
/home/crifan/develop/eclipse/eclipse/jre/bin/java
java in your current PATH

如图:

a java runtime environment jre or java development kit must be available

 

 

【解决过程】

1.很明显,是没有找到java。

所以,要么是Ubuntu中没有安装Java,要么是安装了java,但是没有把路径加到PATH中。

2.参考:

已解决:A Java RunTime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No java virtual machine was found after searching the following locations:…

虽然有解决办法,但是觉得很不靠谱。

3.参考:

problem running eclipse on ubuntu?

去安装java,结果却由于依赖性问题,无法安装:

crifan@ubuntu:eclipse$ sudo apt-get install openjdk-7-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-7-jre : Depends: openjdk-7-jre-headless (= 7u25-2.3.10-1ubuntu0.12.04.2) but it is not going to be installed
                 Recommends: libgconf2-4 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
crifan@ubuntu:eclipse$ 

4.搜一下,现在有哪些openjdk:

crifan@ubuntu:eclipse$ apt-cache search openjdk
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
icedtea-6-jre-cacao - Alternative JVM for OpenJDK, using Cacao
icedtea-6-jre-jamvm - Alternative JVM for OpenJDK, using JamVM
icedtea-6-plugin - web browser plugin based on OpenJDK and IcedTea to execute Java applets
libreoffice - office productivity suite
openjdk-6-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-6-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-6-doc - OpenJDK Development Kit (JDK) documentation
openjdk-6-jdk - OpenJDK Development Kit (JDK)
openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-6-jre-lib - OpenJDK Java runtime (architecture independent libraries)
openjdk-6-source - OpenJDK Development Kit (JDK) source files
default-jdk - Standard Java or Java compatible Development Kit
default-jre - Standard Java or Java compatible Runtime
default-jre-headless - Standard Java or Java compatible Runtime (headless)
freemind - Java Program for creating and viewing Mindmaps
icedtea-7-jre-jamvm - Alternative JVM for OpenJDK, using JamVM
icedtea-7-plugin - web browser plugin based on OpenJDK and IcedTea to execute Java applets
jtreg - Regression Test Harness for the OpenJDK platform
openjdk-6-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-7-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-7-doc - OpenJDK Development Kit (JDK) documentation
openjdk-7-jdk - OpenJDK Development Kit (JDK)
openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries)
openjdk-7-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-7-source - OpenJDK Development Kit (JDK) source files
uwsgi-app-integration-plugins - plugins for integration of uWSGI and application
uwsgi-plugin-jvm-openjdk-6 - Java plugin for uWSGI (OpenJDK 6)
uwsgi-plugin-jwsgi-openjdk-6 - JWSGI plugin for uWSGI (OpenJDK 6)
icedtea-7-jre-cacao - Transitional package for obsolete Cacao JVM for OpenJDK
java-package - Utility for creating Java Debian packages
crifan@ubuntu:eclipse$ 

5.然后去试试安装那个openjdk-7-jre-lib,结果同样错误:

crifan@ubuntu:eclipse$ sudo apt-get install openjdk-7-jre-lib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-7-jre-lib : Depends: openjdk-7-jre-headless (>= 7~b130~pre0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
crifan@ubuntu:eclipse$ 

6.再去试试那个oracle-java7-jre,结果根本找不到:

crifan@ubuntu:eclipse$ sudo apt-get install oracle-java7-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package oracle-java7-jre
crifan@ubuntu:eclipse$ 

注:我此处是163的源。

7.参考:

Setting up eclipse on ubuntu

去确认一下,当前的JAVA_HOME是否正常,结果是空的:

crifan@ubuntu:eclipse$ echo $JAVA_HOME

crifan@ubuntu:eclipse$

8.然后想要查看当前所有的环境变量,看看是否有JAVA_HOME:

【已解决】Ubuntu中显示当前所有的环境变量

结果是没有:

crifan@ubuntu:eclipse$ env
SSH_AGENT_PID=1815
GPG_AGENT_INFO=/run/user/crifan/keyring-ypbBAB/gpg:0:1
SHELL=/bin/bash
TERM=xterm
XDG_SESSION_COOKIE=0a0bee208665f2e846489a7a5201cc2e-1376291429.866841-1612993008
WINDOWID=54539546
GNOME_KEYRING_CONTROL=/run/user/crifan/keyring-ypbBAB
GTK_MODULES=overlay-scrollbar
USER=crifan
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/crifan/keyring-ypbBAB/ssh
SESSION_MANAGER=local/ubuntu:@/tmp/.ICE-unix/1621,unix/ubuntu:/tmp/.ICE-unix/1621
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin
DESKTOP_SESSION=ubuntu
PWD=/home/crifan/develop/eclipse/eclipse
LANG=en_US.UTF-8
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
UBUNTU_MENUPROXY=libappmenu.so
COMPIZ_CONFIG_PROFILE=ubuntu
GDMSESSION=ubuntu
SHLVL=1
HOME=/home/crifan
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=crifan
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-9VvgvBhebq,guid=91e5460bc6b671a0784b34b852088a6a
LESSOPEN=| /usr/bin/lesspipe %s
TEXTDOMAIN=im-config
DISPLAY=:0.0
XDG_RUNTIME_DIR=/run/user/crifan
XDG_CURRENT_DESKTOP=Unity
LESSCLOSE=/usr/bin/lesspipe %s %s
TEXTDOMAINDIR=/usr/share/locale/
XAUTHORITY=/home/crifan/.Xauthority
COLORTERM=gnome-terminal
_=/usr/bin/env

9.所以,先去确认一下,当前的java的真正路径,结果真的没找到java:

crifan@ubuntu:eclipse$ ls / -lh
total 96K
drwxr-xr-x   2 root root 4.0K Aug 11 19:30 bin
drwxr-xr-x   3 root root 4.0K Aug 12 00:13 boot
drwxr-xr-x   2 root root 4.0K Aug  6 19:43 cdrom
drwxr-xr-x  15 root root 4.3K Aug 12 00:13 dev
drwxr-xr-x 137 root root  12K Aug 12 00:24 etc
drwxr-xr-x   4 root root 4.0K Aug  7 01:04 home
lrwxrwxrwx   1 root root   32 Aug 11 19:32 initrd.img -> boot/initrd.img-3.8.0-27-generic
lrwxrwxrwx   1 root root   33 Aug 11 19:32 initrd.img.old -> /boot/initrd.img-3.8.0-27-generic
drwxr-xr-x  22 root root 4.0K Aug  6 20:53 lib
drwx------   2 root root  16K Aug  6 19:41 lost+found
drwxr-xr-x   4 root root 4.0K Aug  7 18:44 media
drwxr-xr-x   3 root root 4.0K Aug  7 02:38 mnt
drwxr-xr-x   4 root root 4.0K Aug  7 02:56 opt
dr-xr-xr-x 192 root root    0 Aug 12 00:10 proc
drwx------  12 root root 4.0K Aug  7 00:57 root
drwxr-xr-x  22 root root  780 Aug 12 00:10 run
drwxr-xr-x   2 root root  12K Aug 12 00:12 sbin
drwxr-xr-x   2 root root 4.0K Jun 11  2012 selinux
drwxr-xr-x   2 root root 4.0K Apr 24 10:02 srv
dr-xr-xr-x  13 root root    0 Aug 12 00:10 sys
drwxrwxrwt   8 root root 4.0K Aug 12 01:50 tmp
drwxr-xr-x  10 root root 4.0K Apr 24 10:02 usr
drwxr-xr-x  13 root root 4.0K Aug 12 00:10 var
lrwxrwxrwx   1 root root   29 Aug 11 19:32 vmlinuz -> boot/vmlinuz-3.8.0-27-generic
lrwxrwxrwx   1 root root   29 Aug 11 19:32 vmlinuz.old -> boot/vmlinuz-3.8.0-27-generic
crifan@ubuntu:eclipse$ ls /bin/
Display all 150 possibilities? (y or n)
crifan@ubuntu:eclipse$ ls /usr/bin/
Display all 1469 possibilities? (y or n)
crifan@ubuntu:eclipse$ ls /usr/bin/j
join     json_pp  
crifan@ubuntu:eclipse$ ls /usr/bin/^C

10.然后,通过输入java,发现有用的提示:

crifan@ubuntu:eclipse$ java
The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.6-jre-headless
 * gcj-4.7-jre-headless
 * openjdk-7-jre-headless
 * openjdk-6-jre-headless
Try: sudo apt-get install <selected package>
crifan@ubuntu:eclipse$ 

所以,可以去试试安装那个openjdk-7-jre-headless:

结果还是无法安装:

crifan@ubuntu:eclipse$ sudo apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-7-jre-headless : Depends: ca-certificates-java but it is not going to be installed
                          Depends: tzdata-java (>= 2012e-0ubuntu0.12.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
crifan@ubuntu:eclipse$ 

11.再去试试其他几个最后只有可以gcj-4.6-jre-headless安装:

crifan@ubuntu:eclipse$ sudo apt-get install default-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 default-jre : Depends: default-jre-headless (= 1:1.6-43ubuntu2) but it is not going to be installed
               Depends: openjdk-6-jre (>= 6b23~pre11-1ubuntu1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
crifan@ubuntu:eclipse$ sudo apt-get install openjdk-6-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-6-jre-headless : Depends: ca-certificates-java but it is not going to be installed
                          Depends: tzdata-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
crifan@ubuntu:eclipse$ sudo apt-get install gcj-4.7-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package gcj-4.7-jre-headless
E: Couldn't find any package by regex 'gcj-4.7-jre-headless'
crifan@ubuntu:eclipse$ sudo apt-get install gcj-4.6-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gcj-4.6-base gcj-4.6-jre-lib libgcj-common libgcj12
Suggested packages:
  fastjar gcj-4.6-jdk libgcj12-awt libgcj12-dbg
The following NEW packages will be installed:
  gcj-4.6-base gcj-4.6-jre-headless gcj-4.6-jre-lib libgcj-common libgcj12
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.1 MB of archives.
After this operation, 51.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.163.com/ubuntu/ precise/main gcj-4.6-base i386 4.6.3-1ubuntu2 [11.3 kB]
Get:2 http://mirrors.163.com/ubuntu/ precise/main libgcj-common all 1:4.6.3-1ubuntu5 [127 kB]
Get:3 http://mirrors.163.com/ubuntu/ precise/main libgcj12 i386 4.6.3-1ubuntu2 [11.4 MB]                                                        
Get:4 http://mirrors.163.com/ubuntu/ precise/main gcj-4.6-jre-headless i386 4.6.3-1ubuntu2 [60.0 kB]                                            
Get:5 http://mirrors.163.com/ubuntu/ precise/main gcj-4.6-jre-lib all 4.6.3-1ubuntu2 [10.5 MB]                                                  
Fetched 22.1 MB in 1min 33s (235 kB/s)                                                                                                          
Selecting previously unselected package gcj-4.6-base.
(Reading database ... 187522 files and directories currently installed.)
Unpacking gcj-4.6-base (from .../gcj-4.6-base_4.6.3-1ubuntu2_i386.deb) ...
Selecting previously unselected package libgcj-common.
Unpacking libgcj-common (from .../libgcj-common_1%3a4.6.3-1ubuntu5_all.deb) ...
Selecting previously unselected package libgcj12.
Unpacking libgcj12 (from .../libgcj12_4.6.3-1ubuntu2_i386.deb) ...
Selecting previously unselected package gcj-4.6-jre-headless.
Unpacking gcj-4.6-jre-headless (from .../gcj-4.6-jre-headless_4.6.3-1ubuntu2_i386.deb) ...
Selecting previously unselected package gcj-4.6-jre-lib.
Unpacking gcj-4.6-jre-lib (from .../gcj-4.6-jre-lib_4.6.3-1ubuntu2_all.deb) ...
Processing triggers for man-db ...
Setting up gcj-4.6-base (4.6.3-1ubuntu2) ...
Setting up libgcj-common (1:4.6.3-1ubuntu5) ...
Setting up libgcj12 (4.6.3-1ubuntu2) ...
Setting up gcj-4.6-jre-headless (4.6.3-1ubuntu2) ...
Setting up gcj-4.6-jre-lib (4.6.3-1ubuntu2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
crifan@ubuntu:eclipse$ 

安装后,试试java是否可用,貌似是可用的:

crifan@ubuntu:eclipse$ java --version
java version "1.5.0"
gij (GNU libgcj) version 4.6.3

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
crifan@ubuntu:eclipse$ which java
/usr/bin/java

但是,貌似JAVA_HOME,是什么,都不知道。。。

12.所以,看来,还是先去解决上面那个错误吧:

【未解决】Ubuntu中安装jre结果出错:openjdk-7-jre-headless : Depends: ca-certificates-java but it is not going to be installed

13.后来参考:

openjdk-7-jre_7u25-2.3.10-1ubuntu0.12.04.2_amd64.deb

看到有:

/usr/lib/jvm

中有java。

所以去看了看,果然有:

crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/
java-1.5.0-gcj-4.6/  java-gcj-4.6/        .java-gcj-4.6.jinfo  
crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/java-1.5.0-gcj-4.6/
bin  jre  lib  man
crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/java-1.5.0-gcj-4.6/bin/
gcj-dbtool  gij  java  keytool  orbd  rmid  rmiregistry  tnameserv
crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/java-
java-1.5.0-gcj-4.6/ java-gcj-4.6/       
crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/java-gcj-4.6/
bin/ jre/ lib/ man/ 
crifan@ubuntu:openjdk-7-7u25-2.3.10$ ls /usr/lib/jvm/java-gcj-4.6/bin/
gcj-dbtool  gij  java  keytool  orbd  rmid  rmiregistry  tnameserv
crifan@ubuntu:openjdk-7-7u25-2.3.10$ 

所以,尝试去设置JAVA_HOME。

参考:

How to set JAVA_HOME in Ubuntu?

去加上:

PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin:/usr/lib/jvm/java-gcj-4.6

然后source使其生效,然后再去运行Eclipse试试,结果说是版本太低:

incompatible jvm version 1.5.0 of the jvm is not suitable

14.所以,还是要想办法,去安装1.6或1.7的java才可以。

15.后来,解决了:

【已解决】Ubuntu中安装jre结果出错:openjdk-7-jre-headless : Depends: ca-certificates-java but it is not going to be installed

接着,就可以去:

(1)卸载旧的1.5的java:

crifan@ubuntu:openjdk-7-7u25-2.3.10$ sudo apt-get autoremove gcj-4.6-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gcj-4.6-base gcj-4.6-jre-headless gcj-4.6-jre-lib libgcj-common libgcj12
0 upgraded, 0 newly installed, 5 to remove and 6 not upgraded.
After this operation, 51.9 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 188432 files and directories currently installed.)
Removing gcj-4.6-jre-lib ...
Removing gcj-4.6-jre-headless ...
Removing libgcj12 ...
Removing gcj-4.6-base ...
Removing libgcj-common ...
Processing triggers for man-db ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

(2)再把之前在.bashrc中加到PATH的路径去掉:

PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin
#PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin:/usr/lib/jvm/java-gcj-4.6

以及:

crifan@ubuntu:openjdk-7-7u25-2.3.10$ source ~/.bashrc

(3)确认重新安装最新的1.7的java:

crifan@ubuntu:eclipse$ java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
crifan@ubuntu:eclipse$ javac --version
The program 'javac' can be found in the following packages:
 * default-jdk
 * ecj
 * gcj-4.6-jdk
 * gcj-4.7-jdk
 * openjdk-7-jdk
 * openjdk-6-jdk
Try: sudo apt-get install <selected package>
crifan@ubuntu:eclipse$ sudo apt-get install openjdk-7-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libatk-wrapper-java libatk-wrapper-java-jni libbonobo2-0 libbonobo2-common libgconf2-4 libgif4
  libgnome2-0 libgnome2-bin libgnome2-common libgnomevfs2-0 libgnomevfs2-common libice-dev libidl-common
  libidl0 liborbit2 libpthread-stubs0 libpthread-stubs0-dev libsm-dev libx11-dev libx11-doc libxau-dev
  libxcb1-dev libxdmcp-dev libxt-dev openjdk-7-jre ttf-dejavu-extra x11proto-core-dev x11proto-input-dev
  x11proto-kb-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
  libbonobo2-bin desktop-base libgnomevfs2-bin libgnomevfs2-extra gamin fam gnome-mime-data libice-doc
  libsm-doc libxcb-doc libxt-doc openjdk-7-demo openjdk-7-source visualvm icedtea-7-plugin
The following NEW packages will be installed:
  libatk-wrapper-java libatk-wrapper-java-jni libbonobo2-0 libbonobo2-common libgconf2-4 libgif4
  libgnome2-0 libgnome2-bin libgnome2-common libgnomevfs2-0 libgnomevfs2-common libice-dev libidl-common
  libidl0 liborbit2 libpthread-stubs0 libpthread-stubs0-dev libsm-dev libx11-dev libx11-doc libxau-dev
  libxcb1-dev libxdmcp-dev libxt-dev openjdk-7-jdk openjdk-7-jre ttf-dejavu-extra x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 32 newly installed, 0 to remove and 6 not upgraded.
Need to get 24.7 MB of archives.
After this operation, 52.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgif4 i386 4.1.6-10ubuntu1 [31.3 kB]
Get:2 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main openjdk-7-jre i386 7u25-2.3.10-1ubuntu0.13.04.2 [225 kB]
Get:3 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libatk-wrapper-java all 0.30.4-0ubuntu4 [29.8 kB]
Get:4 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libatk-wrapper-java-jni i386 0.30.4-0ubuntu4 [31.7 kB]
Get:5 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libbonobo2-common all 2.32.1-0ubuntu3 [34.1 kB]
Get:6 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libidl-common all 0.8.14-0.2ubuntu3 [8,536 B]
Get:7 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libidl0 i386 0.8.14-0.2ubuntu3 [76.9 kB]
Get:8 http://mirrors.ustc.edu.cn/ubuntu/ raring/main liborbit2 i386 1:2.14.19-0.1ubuntu2 [143 kB]
Get:9 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libbonobo2-0 i386 2.32.1-0ubuntu3 [204 kB]
Get:10 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgnomevfs2-common i386 1:2.24.4-1ubuntu5 [23.1 kB]
Get:11 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgnomevfs2-0 i386 1:2.24.4-1ubuntu5 [209 kB]
Get:12 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgnome2-common all 2.32.1-2ubuntu4 [33.3 kB]
Get:13 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgnome2-bin i386 2.32.1-2ubuntu4 [14.9 kB]
Get:14 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgnome2-0 i386 2.32.1-2ubuntu4 [42.0 kB]
Get:15 http://mirrors.ustc.edu.cn/ubuntu/ raring/main ttf-dejavu-extra all 2.33-3ubuntu2 [1,680 kB]
Get:16 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libgconf2-4 i386 3.2.6-0ubuntu1 [2,046 B]
Get:17 http://mirrors.ustc.edu.cn/ubuntu/ raring/main xorg-sgml-doctools all 1:1.10-1 [12.0 kB]
Get:18 http://mirrors.ustc.edu.cn/ubuntu/ raring/main x11proto-core-dev all 7.0.23-1 [744 kB]
Get:19 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libice-dev i386 2:1.0.8-2 [52.3 kB]
Get:20 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libpthread-stubs0 i386 0.3-3 [3,264 B]
Get:21 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libpthread-stubs0-dev i386 0.3-3 [2,860 B]
Get:22 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libsm-dev i386 2:1.2.1-2 [17.6 kB]
Get:23 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libxau-dev i386 1:1.0.7-1 [10.0 kB]
Get:24 http://mirrors.ustc.edu.cn/ubuntu/ raring/main libxdmcp-dev i386 1:1.1.1-1 [26.8 kB]
Get:25 http://mirrors.ustc.edu.cn/ubuntu/ raring/main x11proto-input-dev all 2.2.99.1-0ubuntu1 [139 kB]
Get:26 http://mirrors.ustc.edu.cn/ubuntu/ raring/main x11proto-kb-dev all 1.0.6-2 [269 kB]
Get:27 http://mirrors.ustc.edu.cn/ubuntu/ raring/main xtrans-dev all 1.2.7-1 [84.3 kB]
Get:28 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main libxcb1-dev i386 1.8.1-2ubuntu2.1 [81.2 kB]
Get:29 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main libx11-dev i386 2:1.5.0-1ubuntu1.1 [895 kB]
Get:30 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main libx11-doc all 2:1.5.0-1ubuntu1.1 [2,448 kB]
Get:31 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main libxt-dev i386 1:1.1.3-1ubuntu0.13.04.1 [472 kB]
Get:32 http://mirrors.ustc.edu.cn/ubuntu/ raring-updates/main openjdk-7-jdk i386 7u25-2.3.10-1ubuntu0.13.04.2 [16.6 MB]
Fetched 24.7 MB in 12s (1,995 kB/s)                                                                         
Extracting templates from packages: 100%
Selecting previously unselected package libgif4:i386.
(Reading database ... 188328 files and directories currently installed.)
Unpacking libgif4:i386 (from .../libgif4_4.1.6-10ubuntu1_i386.deb) ...
Selecting previously unselected package openjdk-7-jre:i386.
Unpacking openjdk-7-jre:i386 (from .../openjdk-7-jre_7u25-2.3.10-1ubuntu0.13.04.2_i386.deb) ...
Selecting previously unselected package libatk-wrapper-java.
Unpacking libatk-wrapper-java (from .../libatk-wrapper-java_0.30.4-0ubuntu4_all.deb) ...
Selecting previously unselected package libatk-wrapper-java-jni:i386.
Unpacking libatk-wrapper-java-jni:i386 (from .../libatk-wrapper-java-jni_0.30.4-0ubuntu4_i386.deb) ...
Selecting previously unselected package libbonobo2-common.
Unpacking libbonobo2-common (from .../libbonobo2-common_2.32.1-0ubuntu3_all.deb) ...
Selecting previously unselected package libidl-common.
Unpacking libidl-common (from .../libidl-common_0.8.14-0.2ubuntu3_all.deb) ...
Selecting previously unselected package libidl0:i386.
Unpacking libidl0:i386 (from .../libidl0_0.8.14-0.2ubuntu3_i386.deb) ...
Selecting previously unselected package liborbit2:i386.
Unpacking liborbit2:i386 (from .../liborbit2_1%3a2.14.19-0.1ubuntu2_i386.deb) ...
Selecting previously unselected package libbonobo2-0:i386.
Unpacking libbonobo2-0:i386 (from .../libbonobo2-0_2.32.1-0ubuntu3_i386.deb) ...
Selecting previously unselected package libgnomevfs2-common.
Unpacking libgnomevfs2-common (from .../libgnomevfs2-common_1%3a2.24.4-1ubuntu5_i386.deb) ...
Selecting previously unselected package libgnomevfs2-0:i386.
Unpacking libgnomevfs2-0:i386 (from .../libgnomevfs2-0_1%3a2.24.4-1ubuntu5_i386.deb) ...
Selecting previously unselected package libgnome2-common.
Unpacking libgnome2-common (from .../libgnome2-common_2.32.1-2ubuntu4_all.deb) ...
Selecting previously unselected package libgnome2-bin.
Unpacking libgnome2-bin (from .../libgnome2-bin_2.32.1-2ubuntu4_i386.deb) ...
Selecting previously unselected package libgnome2-0:i386.
Unpacking libgnome2-0:i386 (from .../libgnome2-0_2.32.1-2ubuntu4_i386.deb) ...
Selecting previously unselected package ttf-dejavu-extra.
Unpacking ttf-dejavu-extra (from .../ttf-dejavu-extra_2.33-3ubuntu2_all.deb) ...
Selecting previously unselected package libgconf2-4:i386.
Unpacking libgconf2-4:i386 (from .../libgconf2-4_3.2.6-0ubuntu1_i386.deb) ...
Selecting previously unselected package xorg-sgml-doctools.
Unpacking xorg-sgml-doctools (from .../xorg-sgml-doctools_1%3a1.10-1_all.deb) ...
Selecting previously unselected package x11proto-core-dev.
Unpacking x11proto-core-dev (from .../x11proto-core-dev_7.0.23-1_all.deb) ...
Selecting previously unselected package libice-dev:i386.
Unpacking libice-dev:i386 (from .../libice-dev_2%3a1.0.8-2_i386.deb) ...
Selecting previously unselected package libpthread-stubs0:i386.
Unpacking libpthread-stubs0:i386 (from .../libpthread-stubs0_0.3-3_i386.deb) ...
Selecting previously unselected package libpthread-stubs0-dev:i386.
Unpacking libpthread-stubs0-dev:i386 (from .../libpthread-stubs0-dev_0.3-3_i386.deb) ...
Selecting previously unselected package libsm-dev:i386.
Unpacking libsm-dev:i386 (from .../libsm-dev_2%3a1.2.1-2_i386.deb) ...
Selecting previously unselected package libxau-dev:i386.
Unpacking libxau-dev:i386 (from .../libxau-dev_1%3a1.0.7-1_i386.deb) ...
Selecting previously unselected package libxdmcp-dev:i386.
Unpacking libxdmcp-dev:i386 (from .../libxdmcp-dev_1%3a1.1.1-1_i386.deb) ...
Selecting previously unselected package x11proto-input-dev.
Unpacking x11proto-input-dev (from .../x11proto-input-dev_2.2.99.1-0ubuntu1_all.deb) ...
Selecting previously unselected package x11proto-kb-dev.
Unpacking x11proto-kb-dev (from .../x11proto-kb-dev_1.0.6-2_all.deb) ...
Selecting previously unselected package xtrans-dev.
Unpacking xtrans-dev (from .../xtrans-dev_1.2.7-1_all.deb) ...
Selecting previously unselected package libxcb1-dev:i386.
Unpacking libxcb1-dev:i386 (from .../libxcb1-dev_1.8.1-2ubuntu2.1_i386.deb) ...
Selecting previously unselected package libx11-dev:i386.
Unpacking libx11-dev:i386 (from .../libx11-dev_2%3a1.5.0-1ubuntu1.1_i386.deb) ...
Selecting previously unselected package libx11-doc.
Unpacking libx11-doc (from .../libx11-doc_2%3a1.5.0-1ubuntu1.1_all.deb) ...
Selecting previously unselected package libxt-dev:i386.
Unpacking libxt-dev:i386 (from .../libxt-dev_1%3a1.1.3-1ubuntu0.13.04.1_i386.deb) ...
Selecting previously unselected package openjdk-7-jdk:i386.
Unpacking openjdk-7-jdk:i386 (from .../openjdk-7-jdk_7u25-2.3.10-1ubuntu0.13.04.2_i386.deb) ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for man-db ...
Processing triggers for gconf2 ...
Processing triggers for fontconfig ...
Setting up libgif4:i386 (4.1.6-10ubuntu1) ...
Setting up libbonobo2-common (2.32.1-0ubuntu3) ...
Setting up libidl-common (0.8.14-0.2ubuntu3) ...
Setting up libidl0:i386 (0.8.14-0.2ubuntu3) ...
Setting up liborbit2:i386 (1:2.14.19-0.1ubuntu2) ...
Setting up libbonobo2-0:i386 (2.32.1-0ubuntu3) ...
Setting up libgnomevfs2-common (1:2.24.4-1ubuntu5) ...
Setting up libgnomevfs2-0:i386 (1:2.24.4-1ubuntu5) ...
Setting up libgnome2-common (2.32.1-2ubuntu4) ...
Setting up ttf-dejavu-extra (2.33-3ubuntu2) ...
Setting up libgconf2-4:i386 (3.2.6-0ubuntu1) ...
Setting up xorg-sgml-doctools (1:1.10-1) ...
Setting up x11proto-core-dev (7.0.23-1) ...
Setting up libice-dev:i386 (2:1.0.8-2) ...
Setting up libpthread-stubs0:i386 (0.3-3) ...
Setting up libpthread-stubs0-dev:i386 (0.3-3) ...
Setting up libsm-dev:i386 (2:1.2.1-2) ...
Setting up libxau-dev:i386 (1:1.0.7-1) ...
Setting up libxdmcp-dev:i386 (1:1.1.1-1) ...
Setting up x11proto-input-dev (2.2.99.1-0ubuntu1) ...
Setting up x11proto-kb-dev (1.0.6-2) ...
Setting up xtrans-dev (1.2.7-1) ...
Setting up libxcb1-dev:i386 (1.8.1-2ubuntu2.1) ...
Setting up libx11-dev:i386 (2:1.5.0-1ubuntu1.1) ...
Setting up libx11-doc (2:1.5.0-1ubuntu1.1) ...
Setting up libxt-dev:i386 (1:1.1.3-1ubuntu0.13.04.1) ...
Setting up openjdk-7-jre:i386 (7u25-2.3.10-1ubuntu0.13.04.2) ...
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode
Setting up libatk-wrapper-java (0.30.4-0ubuntu4) ...
Setting up openjdk-7-jdk:i386 (7u25-2.3.10-1ubuntu0.13.04.2) ...
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/javah to provide /usr/bin/javah (javah) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
Setting up libatk-wrapper-java-jni:i386 (0.30.4-0ubuntu4) ...
Setting up libgnome2-bin (2.32.1-2ubuntu4) ...
Setting up libgnome2-0:i386 (2.32.1-2ubuntu4) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

确认一下:

crifan@ubuntu:eclipse$ ls /usr/lib/jvm/
java-1.7.0-openjdk-i386/        java-7-openjdk-common/          
.java-1.7.0-openjdk-i386.jinfo  java-7-openjdk-i386/            
crifan@ubuntu:eclipse$ ls /usr/lib/jvm/java-1.7.0-openjdk-i386/
ASSEMBLY_EXCEPTION  docs/               jre/                man/                THIRD_PARTY_README
bin/                include/            lib/                src.zip             
crifan@ubuntu:eclipse$ ls /usr/lib/jvm/java-1.7.0-openjdk-i386/bin -lh
total 236K
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 appletviewer
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 apt
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 extcheck
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 idlj
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jar
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jarsigner
lrwxrwxrwx 1 root root   15 Jul  3 12:59 java -> ../jre/bin/java
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 javac
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 javadoc
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 javah
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 javap
-rwxr-xr-x 1 root root 2.8K Jul  3 07:04 java-rmi.cgi
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jcmd
-rwxr-xr-x 1 root root 5.6K Jul  3 13:00 jconsole
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jdb
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jhat
-rwxr-xr-x 1 root root 5.6K Jul  3 13:00 jinfo
-rwxr-xr-x 1 root root 5.6K Jul  3 13:00 jmap
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jps
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jrunscript
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jsadebugd
-rwxr-xr-x 1 root root 5.6K Jul  3 13:00 jstack
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jstat
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 jstatd
lrwxrwxrwx 1 root root   18 Jul  3 12:59 keytool -> ../jre/bin/keytool
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 native2ascii
lrwxrwxrwx 1 root root   15 Jul  3 12:59 orbd -> ../jre/bin/orbd
lrwxrwxrwx 1 root root   18 Jul  3 12:59 pack200 -> ../jre/bin/pack200
lrwxrwxrwx 1 root root   21 Jul  3 12:59 policytool -> ../jre/bin/policytool
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 rmic
lrwxrwxrwx 1 root root   15 Jul  3 12:59 rmid -> ../jre/bin/rmid
lrwxrwxrwx 1 root root   22 Jul  3 12:59 rmiregistry -> ../jre/bin/rmiregistry
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 schemagen
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 serialver
lrwxrwxrwx 1 root root   21 Jul  3 12:59 servertool -> ../jre/bin/servertool
lrwxrwxrwx 1 root root   20 Jul  3 12:59 tnameserv -> ../jre/bin/tnameserv
lrwxrwxrwx 1 root root   20 Jul  3 12:59 unpack200 -> ../jre/bin/unpack200
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 wsgen
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 wsimport
-rwxr-xr-x 1 root root 5.5K Jul  3 13:00 xjc
crifan@ubuntu:eclipse$ 

 

(4)且加上JAVA_HOME了:

#PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin
PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386/

source一下:

crifan@ubuntu:eclipse$ source ~/.bashrc

即可找到:

crifan@ubuntu:eclipse$ java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32	  use a 32-bit data model if available
    -d64	  use a 64-bit data model if available
    -client	  to select the "client" VM
    -server	  to select the "server" VM
    -zero	  to select the "zero" VM
    -jamvm	  to select the "jamvm" VM
    -avian	  to select the "avian" VM
    -hotspot	  is a synonym for the "client" VM  [deprecated]
                  The default VM is server,
                  because you are running on a server-class machine.


    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
crifan@ubuntu:eclipse$ javac -version
javac 1.7.0_25
crifan@ubuntu:eclipse$ which java
/usr/bin/java

(5)再去双击运行Eclipse,结果终于可以正常打开了:

eclipse kepler can run

包括第一次跳出界面,设置workspace:

set eclipse workspace

 

【总结】

当双击Eclipse运行出错:

 

时,解决办法很简单:

1.安装jre(我此处安装的是jdk,包括了jre):

sudo apt-get install openjdk-7-jdk

2.设置好对应的JAVA_HOME

PATH=$PATH:/opt/crosstool-ng/bin:/opt/crosscompile/xscale/gcc-4.6.0-glibc-2.9/bin:/opt/crosscompile/curl/bin:/opt/crosscompile/pcre/bin:/usr/lib/jvm/java-1.7.0-openjdk-i386/

即可。



One Thought on “【已解决】Ubuntu中双击Eclipse结果出错:A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse

  1. Pingback: ubuntu 安装 zend studio – 刘章 | 查问题

发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量