java.lang.NoClassDefFoundError: java.awt.Container
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14117541/
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
java.lang.NoClassDefFoundError: java.awt.Container
提问by Homunculus Reticulli
I am trying to install Visual Paradigm for UML. During the installation it crashes. This is the stack trace:
我正在尝试为 UML 安装 Visual Paradigm。在安装过程中它崩溃了。这是堆栈跟踪:
Unpacking JRE ...
Preparing JRE ...
Starting Installer ...
java.lang.NoClassDefFoundError: java.awt.Container
at com.install4j.runtime.installer.frontend.headless.AbstractHeadlessScreenExecutor.init(Unknown Source)
at com.install4j.runtime.installer.frontend.headless.ConsoleScreenExecutor.<init>(Unknown Source)
at com.install4j.runtime.installer.frontend.headless.InstallerConsoleScreenExecutor.<init>(Unknown Source)
at com.install4j.runtime.installer.Installer.getScreenExecutor(Unknown Source)
at com.install4j.runtime.installer.Installer.runInProcess(Unknown Source)
at com.install4j.runtime.installer.Installer.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.launcher.Launcher.main(Unknown Source)
java.lang.NoClassDefFoundError: java.awt.Component
at javax.swing.ImageIcon.<clinit>(Unknown Source)
at com.install4j.runtime.installer.frontend.GUIHelper.loadIcon(Unknown Source)
at com.install4j.runtime.installer.frontend.GUIHelper.<clinit>(Unknown Source)
at com.install4j.runtime.installer.helper.InstallerUtil.reportException(Unknown Source)
at com.install4j.runtime.installer.Installer.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.launcher.Launcher.main(Unknown Source)
It appears that the installer can't find a class in the WT library. I can't see how how that can be possible. Does anyone know what is causing this, and how I may fix it?
安装程序似乎在 WT 库中找不到类。我看不出这怎么可能。有谁知道这是什么原因造成的,我该如何解决?
[System Information]
【系统信息】
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
采纳答案by Hayden
I was getting the same problem when trying to install Visual Paradigm on Ubuntu 12.10 64 bit.
尝试在 Ubuntu 12.10 64 位上安装 Visual Paradigm 时遇到了同样的问题。
Java version:
爪哇版:
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
This seemed to fix the problem:
这似乎解决了这个问题:
sudo apt-get install ia32-libs
sudo apt-get install ia32-libs
回答by Ian Rogers
On ubuntu 14.04 the answer given by Hayden didn't work for me as the package doesn't exist.
在 ubuntu 14.04 上,Hayden 给出的答案对我不起作用,因为该软件包不存在。
This did work though:
不过这确实有效:
apt-get install libxtst6:i386
i.e. it needs the 32 bit version of libxtst
即它需要 32 位版本的 libxtst
回答by aal
I have had the same problem installing SoapUI software and this command works for me:
我在安装 SoapUI 软件时遇到了同样的问题,这个命令对我有用:
$ ./soapUI-x32-4.6.0.sh -J-Djava.awt.headless=true
My system:
我的系统:
Linux 3.10-2-amd64 #1 SMP Debian 3.10.7-1 (2013-08-17) x86_64 GNU/Linux
And my JVM version:
还有我的 JVM 版本:
$ java -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
回答by Vanji
Run the script with -J-Djava.awt.headless=true
运行脚本 -J-Djava.awt.headless=true
sh SoapUI-x32-5.0.0.sh -J-Djava.awt.headless=true
sh SoapUI-x32-5.0.0.sh -J-Djava.awt.headless=true
回答by u11230172
Run this command on Ubuntu18.04
在 Ubuntu18.04 上运行此命令
sudo apt-get update
sudo apt-get install libxi6 libxtst6 libxrender1
回答by Ahmad
You may use
您可以使用
`sudo update-java-alternatives -s java-6-oracle`
Instead of using
而不是使用
`sudo update-java-alternatives -s java-6-sun`
or try to change 6
with the version of Java
that you used.
或尝试更改6
with the version of Java
您使用的。
回答by pratikch
In my opinion, This could be problem with OpenJDK. try switching to official Oracle/Sun JDK with this command.
在我看来,这可能是 OpenJDK 的问题。尝试使用此命令切换到官方 Oracle/Sun JDK。
sudo update-java-alternatives -s java-6-sun