我只是尝试安装Netbeans但是有更多的JDK probs

时间:2014-03-01 20:41:43

标签: java linux ubuntu netbeans

我在ubuntu的新手,我想使用netbeans。我从网站上下载了netbeans,然后把这些命令写到了行

 hakki@hakki-K55VM:~/Downloads$ chmod +x netbeans-7.4-linux.sh

 hakki@hakki-K55VM:~/Downloads$ sudo bash netbeans-7.4-linux.sh

 [sudo] password for hakki:

Configuring the installer...
Searching for JVM on the system...
Java SE Development Kit (JDK) was not found on this computer
JDK 7 is required for installing the NetBeans IDE. Make sure that the JDK is properly installed and run installer again.
You can specify valid JDK location using --javahome installer argument.

To download the JDK, visit http://www.oracle.com/technetwork/java/javase/downloads

在我收到上述通知后,我尝试使用这些命令安装JDK

 hakki@hakki-K55VM:~$ sudo apt-get install openjdk-7-jre-headless
 .... 

 done

然后我控制了正确安装的jdk并返回到行

 hakki@hakki-K55VM:~$ java -version

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

在我下载jdk之后,我尝试再次安装netbeans但仍然返回错误并且无法初始化UI。我该如何解决这个问题?

 hakki@hakki-K55VM:~/Downloads$ sudo bash netbeans-7.4-linux.sh

Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Can`t initialize UI
Running in headless mode

Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler i

1 个答案:

答案 0 :(得分:3)

NetBeans表示它需要JDK(Java Development Kit),但您只安装了JRE(Java运行时环境)。

  

我尝试使用这些命令安装JDK

   hakki@hakki-K55VM:~$ sudo apt-get install openjdk-7-jre-headless

您安装了JRE,而不是JDK。

这应该足够了

sudo apt-get install openjdk-7-jdk