For some reason we use com.sun.java.swing.plaf.windows.WindowsComboBoxUI class which worked on Windows/Linux/Mac OS platforms with Java 5.0 through Java 8.0
Starting with Java 10 and Java 11 (we will stick to it as LTS) this class not visible to classloader:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsComboBoxUI
at xxx.YYY.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsComboBoxUI
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
How can we get it working?
We were able to replace com.sun.java.swing.plaf.windows.WindowsComboBoxUI in the code with javax.swing.plaf.basic.BasicComboBoxUI and it seems working fine.
Related
I am new to Java and trying around. Now I would like to learn about network - server client communications. Long story short I found jars on github which should make the start easier. So I downloaded the file and added it to my Modulepath. Everything looked OK while writing a simple start to just connect but when I want to run for testing I get the NoClassDefFoundError ...
Exception in thread "main" java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at fst.serverclient.ssc.SSCNetzwerkTester.main(SSCNetzwerkTester.java:6)
Caused by: java.lang.ClassNotFoundException: com.blogspot.debukkitsblog.net.Server
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 10 more
I do not have any idea what am I doing wrong, the jar should work otherwise it should not be there for download I guess. But the error comes from one of the jar classes called Server:
java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
This question already has answers here:
What is a classpath and how do I set it?
(10 answers)
Closed 2 years ago.
When run application from command line I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
The application compiled fine and even when i specify class path to the json jar still get same error.
root#poker5o:/usr/local/poker5o/SignalChannel# ls
com json-20190722.jar
root#poker5o:/usr/local/poker5o/SignalChannel# java -cp . com.poker5o.Main
Allocating server socket for the server
Sending parameters to DoListen
Back from DoListen
Setting up read/write buffers
Back from SetBuffers
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
I managed to solve the problem by extracting the json JAR , so now i have:
com & org directories on my working directory. DO i always need to extract jars ?
and do i allways have to place my appliction in same path that represents full name ? com.poker5o.Main...? what if i want to bundle everything like distribute application is there a good way to do so ?
I am trying to create AVD on my mac from command line,
avdmanager create avd -n test -k "system-images;android-28;google_apis;x86"
Then I got this error message
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
I tried to fix the problem by doing
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
And then the error message become
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.se.ee not found
It seems java.se.ee was removed in JAVA 11 but now I am using JAVA 13. Is there any solution other than downgrade JAVA version?
At last I downgrade my java to 8 and it worked.
I tried Play 2.6.15 with java 9 and 10 but ended up with the following exception.
[error] a.a.ActorSystemImpl - Uncaught error from thread [application-akka.actor.default-dispatcher-5]: javax/xml/bind/DatatypeConverter, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26)
at io.jsonwebtoken.impl.DefaultJwtParser.setSigningKey(DefaultJwtParser.java:151)
at play.api.mvc.JWTCookieDataCodec$JWTFormatter.parse(Cookie.scala:677)
at play.api.mvc.JWTCookieDataCodec.decode(Cookie.scala:592)
at play.api.mvc.JWTCookieDataCodec.decode$(Cookie.scala:584)
at play.api.mvc.DefaultJWTCookieDataCodec.decode(Cookie.scala:769)
at play.api.mvc.FallbackCookieDataCodec.decode(Cookie.scala:755)
at play.api.mvc.FallbackCookieDataCodec.decode$(Cookie.scala:746)
at play.api.mvc.DefaultSessionCookieBaker.decode(Session.scala:95)
at play.api.mvc.CookieBaker.decodeFromCookie(Cookie.scala:432)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26)
at io.jsonwebtoken.impl.DefaultJwtParser.setSigningKey(DefaultJwtParser.java:151)
at play.api.mvc.JWTCookieDataCodec$JWTFormatter.parse(Cookie.scala:677)
Does Play 2.6.15 support Java 9 and Java 10?
I haven't tried with 9/10, but the installation guide mentions that these versions are not supported.
Play requires Java 1.8.
I want to use box2d.jar as a library in my Java application .
I have copied it from one of my LibGDX projects and added that jar in the libraries of the application . But now I am getting this error .
Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
at com.marimba.space.PhysX.<init>(PhysX.java:40)
at com.marimba.space.Room.<init>(Room.java:14)
at com.marimba.space.Main$1.run(Main.java:62)
at java.lang.Thread.run(Unknown Source)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx-box2d.dll' for target: Windows 7, 32-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:117)
at com.badlogic.gdx.physics.box2d.World.<clinit>(World.java:187)
... 4 more
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: gdx-box2d.dll
at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:126)
at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:261)
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
... 5 more
Any ideas how can I fix this? Or how can I use box2D in my Java application?
I tried jbox2d.jar but that doesn`t contain all the classes of box2d.