在Linux Mint上发布Netbeans

时间:2021-02-23 04:59:03

I just installed Netbeans using the script on Oracle's website and I'm having some trouble getting it to work. After opening Netbeans I went to open up a simple .java file just to test it out and got this error:

我刚刚在Oracle的网站上使用这个脚本安装了Netbeans,我在让它工作上遇到了一些麻烦。打开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丢失了,需要运行一些clean beans模块。请使用——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. 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. Any help is appreciated.

我有OpenJDK,我不确定使用-jdkhome命令行选项意味着什么。我还访问了wiki,它是关于全面安装JDK的,我认为我不需要这样做。任何帮助都是感激。

1 个解决方案

#1


2  

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 install),一切都会顺利进行。

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示例,没有任何问题。

在Linux Mint上发布Netbeans

Here is the setting JDK view in Netbeans:

下面是Netbeans中的设置JDK视图:

在Linux Mint上发布Netbeans

If you want to add the JAVA Home dir to your system

如果您想要将JAVA主目录添加到您的系统中。

Proceed like this

继续像这样

You have to be in root mode and then edit this file: /etc/bash.bashrc and add:

您必须处于根模式,然后编辑这个文件:/etc/bashbashrc并添加(:

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

Reboot your Mint system

重新启动你的薄荷系统

Now you'll have javac working in command line...

现在,您将在命令行中使用javac…

#1


2  

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 install),一切都会顺利进行。

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示例,没有任何问题。

在Linux Mint上发布Netbeans

Here is the setting JDK view in Netbeans:

下面是Netbeans中的设置JDK视图:

在Linux Mint上发布Netbeans

If you want to add the JAVA Home dir to your system

如果您想要将JAVA主目录添加到您的系统中。

Proceed like this

继续像这样

You have to be in root mode and then edit this file: /etc/bash.bashrc and add:

您必须处于根模式,然后编辑这个文件:/etc/bashbashrc并添加(:

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

Reboot your Mint system

重新启动你的薄荷系统

Now you'll have javac working in command line...

现在,您将在命令行中使用javac…