简体   繁体   English

Linux Mint 上的 Netbeans 问题

[英]Issue with Netbeans on Linux Mint

I just installed Netbeans using the script on Oracle's website and I'm having some trouble getting it to work.我刚刚使用 Oracle 网站上的脚本安装了 Netbeans,但在让它工作时遇到了一些麻烦。 After opening Netbeans I went to open up a simple .java file just to test it out and got this error:打开 Netbeans 后,我打开一个简单的 .java 文件只是为了测试它并得到这个错误:

"The JDK is missing and is required to run some Neatbeans modules. Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information." “缺少 JDK,需要运行一些 Neatbeans 模块。请使用 --jdkhome 命令行选项指定 JDK 安装或查看http://wiki.netbeans.org/FaqRunningOnJre以获取更多信息。”

I have OpenJDK, and I'm not sure what's meant by using the --jdkhome command line option.我有 OpenJDK,但我不确定使用 --jdkhome 命令行选项是什么意思。 I also visited the wiki and it's about doing a full installation of JDK, which I don't think I should need to do.我还访问了 wiki,它是关于完整安装 JDK,我认为我不需要这样做。 Any help is appreciated.任何帮助表示赞赏。

I think it's better to use Oracle Java JDK rather than Open JDK if you want to use Netbeans for java development我认为如果您想使用 Netbeans 进行 Java 开发,最好使用 Oracle Java JDK 而不是 Open JDK

You can use this link to set Oracle Java JDK in Linux Mint您可以使用此链接在 Linux Mint 中设置 Oracle Java JDK

So, it's better to follow theses instructions (JDK install) prior to Netbeans install and all things will go well.因此,最好在安装 Netbeans 之前遵循这些说明(JDK 安装),一切都会顺利进行。

Steps:

1-Remove OpenJDK installation
  sudo apt-get update && apt-get remove openjdk*

2- Download Oracle JDK you want to install (for example JDK 8)
   Download the *.tar.gz one.
   example for current version: jdk-8u65-linux-x64.tar.gz

3- Extract the file and create a folder where to move it
   tar -zxvf jdk-8u65-linux-x64.tar.gz
   sudo mkdir -p /opt/java
   sudo mv jdk1.8.0_65 /opt/java

4- Make JDK system default
   sudo update-alternatives --install "/usr/bin/java" "java"  
        "/opt/java/jdk1.8.0_65/bin/java" 1

   sudo update-alternatives --set java /opt/java/jdk1.8.0_65/bin/java

At this stage, you can start the installation of Netbeans IDE and it will automatically detect your Oracle JDK setting在这个阶段,您可以开始安装 Netbeans IDE,它会自动检测您的 Oracle JDK 设置

I tested a short HelloWorld Java example, and I don't have any issue.我测试了一个简短的 HelloWorld Java 示例,我没有任何问题。

在此处输入图片说明

Here is the setting JDK view in Netbeans:这是在 Netbeans 中设置 JDK 视图:

在此处输入图片说明

If you want to add the JAVA Home dir to your system如果要将 JAVA Home 目录添加到系统

Proceed like this像这样进行

You have to be in root mode and then edit this file: /etc/bash.bashrc and add:您必须处于 root 模式,然后编辑此文件: /etc/bash.bashrc并添加:

#JAVA HOME 
JAVA_HOME=/opt/java/jdk1.8.0_65 
export JAVA_HOME 
PATH=$PATH:$JAVA_HOME/bin 
export PATH

Reboot your Mint system重启你的 Mint 系统

Now you'll have javac working in command line...现在你将让javac在命令行中工作......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM