标签归档:JDK

The Maven Integration requires that Eclipse be running in a JDK

在eclipse中安装了m2eclipse(maven插件)

在安装后,出现下列警告:

The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK.

Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify that Installed JRE’s are also using JDK installs.

解决:

(1)set your JDK as a default Java environment in eclipse (default installed JRE)

Open eclipse. Click on ‘Window’ -> ‘Preferences’ -> ‘Java’ -> ‘Installed JREs’.

If you can’t find any JDK on the list -> click ‘Add’ -> ‘Standard VM’ -> set all paths and click ‘Finish’.

After that – check this JDK on the list of installed JREs and click ‘OK’.

(2)add path to your SDK in eclipse.ini

open ‘eclipse.ini’ and add there: -vm path_to_javaw_on_your_machine,so in my example it will be (jdk1.6.0_17 on Windows):

-vm
D:\Javajdk1.6.0_13jrebinjavaw

Notice 1: Do not use paths with spaces! Replace all dir names with spaces to their shortcuts. For example: ‘Program Files’ is ‘Progra~1′.
Notice 2: ‘-vm’ is in the first line, path is in the second line

your ‘eclipse.ini’ looks like this:

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-showsplash
org.eclipse.platform
–launcher.XXMaxPermSize
256m
-vm
D:Javajdk1.6.0_13jrebinjavaw
-vmargs
-Xms40m
-Xmx256m

Notice : ‘-vm’ must be  “-vmargs” above

Restart eclipse and everything should be fine.

Ubuntu 11.10下安装Oracle/SUN JDK

Ubuntu 11.10下安装Oracle/SUN JDK

安装步骤如下:
1, 从Oracle官网上下载Java SE Development Kit 7 

JDK 7u1 版本,链接是http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gz

2, 新建目录,在console终端中,输入cd  /usr/lib,
依次输入sudo mkdir jvm,这样就新建了/usr/lib/jvm这样的目录层次

3,将下载的文件的文件jdk-7u1-linux-i586.tar.gz 拷贝到jvm目录中,

在console终端中,输入cd  /usr/lib/jvm ,

执行解压命令:sudo tar zxf jdk-7u1-linux-i586.tar.gz 得到文件jdk1.7.0_01

4, 设置环境变量,

在终端执行代码:  sudo gedit /etc/environment

添加如下变量:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.7.0_01/bin"
JAVAHOME=/usr/lib/jvm/jdk1.7.0_01
CLASSPATH=.:/usr/lib/jvm/jdk1.7.0_01/lib
5, 设置默认的jdk,因为系统可能将其他已安装的jdk作为默认 ,例如open-jdk,
因此需要在终端执行代码:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_01/bin/java 400
(400是权重,可以设置为更大值)
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_01/bin/java 400
接着输入sudo update-alternatives --config java  ,选择对应的jdk版本。
输入java -version,
检查是否为Oracle/Sun jdk,至此已成功安装sun-jdk。
如下:
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Server VM (build 21.1-b02, mixed mode)