java debian安装netbeans8时出现java.lang.NoClassDefFoundError错误如何解决

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25547555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 08:12:19  来源:igfitidea点击:

How to solve error java.lang.NoClassDefFoundError at the time of installing netbeans8 in debian

javalinuxnetbeansdebian

提问by Tahmina Khatoon

I am trying to install netbeans 8 in debian-7.0-amd64-minimal. (VPS)

我正在尝试在 debian-7.0-amd64-minimal 中安装 netbeans 8。(VPS)

1st I have installed java/JDK latest version (1.8.0_20) by following https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps

第一,我按照https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-安装了 java/JDK 最新版本 (1.8.0_20) ubuntu-vps

Next I am trying to install netbeans by following

接下来我尝试通过以下方式安装 netbeans

http://installnetbeansdebian.blogspot.com/2013/06/how-to-install-netbeans-73-ide-complete.html

http://installnetbeansdebian.blogspot.com/2013/06/how-to-install-netbeans-73-ide-complete.html

when I run

当我跑

./netbeans-8.0-php-linux.sh

it displays the following error.

它显示以下错误。

Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...

Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"

Anybody knows, how to fix this?

有谁知道,如何解决这个问题?

回答by monkey_white

Had a similar issue, for some reason the command

有一个类似的问题,由于某种原因命令

$ sudo chmod -x netbeans-8.2-javaee-linux.sh

didn't create executable file out of the script, so I had to use GUI method, as it shown here in the second answer:

没有从脚本中创建可执行文件,所以我不得不使用 GUI 方法,如第二个答案中所示:

https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-termina

https://askubuntu.com/questions/229589/how-to-make-a-file-ega-sh-script-executable-so-it-can-be-run-from-termina

then as the user Firestormsuggested just dropped sudoand it worked for me:

然后因为用户Firestorm建议放弃sudo并且它对我有用

$./netbeans-8.2-javaee-linux.sh

Installed perfectly even created "Development" department in the "Application" menu and nested program start tag there. Debian-8 x64 KDE

安装完美甚至在“应用程序”菜单中创建了“开发”部门,并在那里嵌套了程序开始标签。Debian-8 x64 KDE

回答by Taurus

Just had the same issue here (Fedora 25, Netbeans 8.2). It only occurs, when executing the installer as root which seems to be a problem with a root-privileged gui in a non-root-privileged environment.

刚刚在这里遇到了同样的问题(Fedora 25,Netbeans 8.2)。它只发生在以 root 身份执行安装程序时,这似乎是非 root 特权环境中 root 特权 gui 的问题。

Solution: Either install netbeans as normal user in your home directory OR launch the installer as root with the switch '--silent':

解决方案:要么以普通用户身份在主目录中安装 netbeans,要么以 root 身份使用开关“--silent”启动安装程序:

./netbeans-8.2-html-linux-x64.sh --silent

which will install netbeans in /usr/local.

这将在 /usr/local 中安装 netbeans。

回答by Isaac Limón

Maybe late. For ubuntu 17

也许晚了。对于 Ubuntu 17

azuka$ : xhost +
azuka$ : sudo su
root$ : sh netbeans-8.2-php-linux.sh

回答by Ismail Ams

I had the same issue on "Fedora 26". But I resolved it by repeating the same procedure but not as 'root' or 'sudo'. I.e:

我在“Fedora 26”上遇到了同样的问题。但是我通过重复相同的过程而不是“root”或“sudo”来解决它。IE:

Change directory to locate the downloaded file. then.

更改目录以找到下载的文件。然后。

$ chmod +x netbeans-8.2-linux.sh
$ ./netbeans-8.2-linux.sh

回答by Jo?o Romario Colorado

The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session

解决方案是以普通用户或您在 X 会话中登录的同一用户身份执行 NetBeans 安装程序

回答by nivas

The solution was to execute the NetBeans installer as a normal user, or any user other than root. define JAVA_HOME and JDK_HOME as environment variable

解决方案是以普通用户或 root 以外的任何用户身份执行 NetBeans 安装程序。将 JAVA_HOME 和 JDK_HOME 定义为环境变量

回答by Evgeniy Baranov

I had the same issue while installing Oracle Developer Studio via ssh X forwarding. I switched jdk from SE to 1.7.0 openjdk (update-alternatives --config java) and then managed to install. I hope it will help someone.

我在通过 ssh X 转发安装 Oracle Developer Studio 时遇到了同样的问题。我将 jdk 从 SE 切换到 1.7.0 openjdk(update-alternatives --config java),然后设法安装。我希望它会帮助某人。

回答by swapnil

Simply close netbean if you open it already 1.install openjdk 2. download netbean and where you download it use below command $./netbeans-8.2-javaee-linux.sh

如果你已经打开它,只需关闭 netbean 1.安装 openjdk 2. 下载 netbean 并在你下载它的地方使用下面的命令 $./netbeans-8.2-javaee-linux.sh

回答by Onlyjob

It is much easier (and more reliable and more secure) to use package management system to install software. All you need to do is to use the following command to install netbeanson Debian:

使用包管理系统安装软件更容易(也更可靠、更安全)。您需要做的就是使用以下命令在Debian上安装netbeans

sudo apt-get install netbeans

Although netbeansversion 7 will be installed (ver. 8 is not available from native Debian repository yet) you won't be struggling to make it work.

尽管将安装netbeans版本 7(版本 8 还不能从本机 Debian 存储库中获得),但您不会为使其工作而苦苦挣扎。

Besides please be careful with instructions to install java/JDK -- the method they describe is not the best. If OpenJDK is not sufficient for you then you might be doing something wrong. If you absolutely have to try Oracle's Java (unfortunately there are some corner cases when it might be needed) please use java-packageto build your own Java package (.deb) from downloadable Java binary.

此外请注意安装 java/JDK 的说明——他们描述的方法不是最好的。如果 OpenJDK 对您来说还不够,那么您可能做错了什么。如果您绝对必须尝试 Oracle 的 Java(不幸的是,在某些极端情况下可能需要它),请使用java-package从可下载的 Java 二进制文件构建您自己的 Java 包 (.deb)。

回答by Firestorm

This question is nearly exactly two years old, but still actually occurred here just now.

这个问题已经快两年了,但刚刚这里居然还发生了。

I had this too on a Slackware system. I was trying to install it like you (because Slackware doesn't provide NetBeans packages) and I was typing in a virtual terminal window after executing su. The problem was the exact same as yours: I got the NoClassDefFound exception and the installer stopped. The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session. Java errors can be a bit cryptical, but the solution's as easy as that.

我在 Slackware 系统上也有这个。我试图像你一样安装它(因为 Slackware 不提供 NetBeans 包)并且我在执行 su 后在虚拟终端窗口中输入。问题与您的完全相同:我遇到了 NoClassDefFound 异常并且安装程序停止了。解决方案是以普通用户或您在 X 会话中登录的同一用户身份执行 NetBeans 安装程序。Java 错误可能有点神秘,但解决方案就这么简单。

I hope this helps.

我希望这有帮助。