Unable to load java class from w3c - java

I am trying to do OPTICS-clustering with ELKI (http://elki.dbs.ifi.lmu.de/).
I try do run the clustering with the provided gui, but then I get this exception:
Error in starting visualizer window.
java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGSVGElement
at de.lmu.ifi.dbs.elki.visualization.gui.ResultWindow.<init>(Unknown Source)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultVisualizer$1.run(Unknown Source)
at [...]
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.svg.SVGSVGElement
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultWindow.<init>(Unknown Source)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultVisualizer$1.run(Unknown Source)
at [...]
I unzipped w3c.jar into /usr/share/java and into the path of the program. But it still gives me the same error.
I have quite an old Ubuntu (10.04) with OpenJDK version IcedTea6 1.13.3. But I guess that is not was is causing the trouble, right?
What to do?

I think you still have to add that jar into classPath and then it will be recognized.Im not sure what ide you use bud in netbeans for instance rightclick project>libraries>add jar/library.Then your classLoader shoudnt be complaining.

Related

Error Console in Spigot server

Pops up that error on the console:
Please help me guys i need this for now!
Error:
[13:36:23] [Server thread/ERROR]: Ambiguous plugin name `'KwadratowyHardcore' for files `plugins\KHH.jar' and `plugins\KH.jar' in `plugins'
[13:36:23] [Server thread/INFO]: Set PluginClassLoader as parallel capable
[13:36:23] [Server thread/ERROR]: Could not load 'plugins\KHH.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.skyter.hardcore.HardcorePlguin'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:66) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot_server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot_server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot_server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot_server.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_21]
Caused by: java.lang.ClassNotFoundException: me.skyter.hardcore.HardcorePlguin
at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_21]
at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_21]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_21]
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_21]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_21]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_21]
at java.lang.Class.forName0(Native Method) ~[?:1.7.0_21]
at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_21]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot_server.jar:git-Spigot-db6de12-18fbb24]
Server it spigot 1.8.9!
I compiles with bukkit api 1.7.2, 1.8.8 and spigot 1.8.9 and craftbukit 1.8.9
The plugin is invalid. Always look for the line with Caused by: (Ctrl+F). You should let the developer of the plugin know.
Caused by: java.lang.ClassNotFoundException: me.skyter.hardcore.HardcorePlguin
Tells you, that the class with this path could not be found, therefor the plugin is invalid / not able to run.
Make sure the paths match, and check your plugin.yml for the wrong path
You have your main class setted worng in plugin.yml
Try to delete KHH.jar or KH.jar (the older one), maybe having the same plugin twice causes a problem.
Ambiguous plugin name `'KwadratowyHardcore' for files `plugins\KHH.jar' and `plugins\KH.jar' in `plugins'
If that doesn't solve the error, look at the other posts here, then the plugin.yml is the problem.
I see two problems here:
In your plugin.yml, the "main" value doesn't point to the actual
class that extends "JavaPlugin".
There are two files containing the plugin with the same name, so
Spigot doesn't know which one to use. Delete the older one and it would be fine.
Cannot find main class `me.skyter.hardcore.HardcorePlguin'
I would recommend changing this to where your Main class that extends JavaPlugin is located. I also see a spelling issue, me.skyter.hardcore.HardcorePlguin. That's where your error is.
You need to make sure that you specifically indicate your Main class (the class with 'extends JavaPlugin') in your plugin.yml file.
It should look something like this:
main: com.YouWebsite.PackageName.Main
name: ProjectName
version: 1.0
author: YourName
If you don't identify where your Main class is, your plugin won't be able to run properly.
You can identify what the issue is in the error message that says:
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.skyter.hardcore.HardcorePlguin'

Apache POI Java program working fine in IDE (Eclipse) but encounter NoClassDefFoundError when I tried to run it as a runnable jar

I got a very strange problem that my program runs in Eclipse but doesn't run well wen exported as a runnable jar. I am getting ClassNotFoundException.
C:\Users\43156557\workspace\CAF3_IDE\MFTRelease>java -jar MSDocWriter.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:149)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:136)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:81)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:1
11)
at com.hsbc.glt.automation.test.mft.util.MSDocumentWriter.initializeDocu
ment(MSDocumentWriter.java:92)
at com.hsbc.glt.automation.test.mft.util.MSDocumentWriter.main(MSDocumen
tWriter.java:70)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
C:\Users\43156557\workspace\CAF3_IDE\MFTRelease>
ClassNotFoundException usually depicts that JVM is not able to load the required class file from the defined classpath (either the path is not correct or the class / jar is not present at the path).
The Error in current scenario might be cause have missed to include the Dependency libraries when creating the jar file. Since on eclipse you have the class-path correctly including those its working perfectly.
Make sure that you check "Package Required Jar into generated JAR" , this will include the jar files automatically from your eclipse build path.
for detailed info this might come handy Include Dependent Jars in Executable Jar

Having trouble running code in Eclipse using JOGL

I'm trying to run an application in eclipse which is setup as MVC app and it is the solution code posted by our professor for a homework. After I copy and pasted all of the classes and tried to run it, I got the following error:
JOGL> Hello JOAL Exception in thread "main" java.lang.NoClassDefFoundError: com/jogamp/openal/JoalVersion at jogamp.opengl.openal.av.ALDummyUsage.main(ALDummyUsage.java:14) Caused by: java.lang.ClassNotFoundException: com.jogamp.openal.JoalVersion at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
I'm not entirely sure what the issue is and apparently no one else has been having the same issue.
My buildpath has a library I titled "JOGL" and I added the external jars gluegen-rt.jar and jogl-all.jar as was instructed by the professor.
Thanks for the help!
Actually, your code uses JOAL too, you need to put joal.jar into your classpath (Build path in Eclipse) and you need to put the JAR(s) containing its native libraries into the same directory as you did for JOGL and GlueGen. I assume you followed these instructions:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Eclipse_IDE_project
Edit.: You don't run your own program for your homework, you try to run ALDummyUsage which is in JOGL itself. If you want to run your own program with your own main class, rather right-click on it and choose "Run As" -> "Java application" in Eclipse.

UnsatisifiedLinkError - Any idea on how to fix this?

Exception in thread "main" java.lang.reflect.InvocationTargetException
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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.melloware.jintellitype.JIntellitypeException: Could not load JIntellitype.dll from local file system or from inside JAR
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:114)
at com.melloware.jintellitype.JIntellitype.getInstance(JIntellitype.java:174)
at CaptureScreen.registerHotkeys(CaptureScreen.java:163)
at CaptureScreen.<init>(CaptureScreen.java:100)
at CaptureScreen.main(CaptureScreen.java:199)
... 5 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\B\AppData\Local\Temp: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:99)
... 9 more
I get this error when I run from the command line, however, it does not cause any issues with my program running on my machine, however, on other peoples machines the program will not run at all.
I have never come across this error before and fairly confused.. mostly that it runs fine on my machine, but not on others even though it throws this error on both.
This is a classpath error. Its likely that you have it set up right for compile time but not runtime. Make sure that either your jar is in the right location and/or that you've set your classpath to include the jar.
Go to the Jintellitype website, download the source, add it to your download folder and then move the .dll files into the folder with the Jitellitype classes after building the project

Exporting project with libraries to runnable jar from Eclipse

I was trying to export a test of a game I am working on(that uses the Slick library), to send to my partners who lack any IDE, all went well with the export in eclipse, but when I try to run it from command prompt, this is what I get in return.
C:\Users\Noah\Desktop>java -jar test.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:141)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
at org.nor.Main.main(Main.java:16)
... 5 more
C:\Users\Noah\Desktop>
Any idea what is going wrong?
NOTE: The project runs perfectly fine in eclipse.
You should read up on a "get started" guide on slick if you are going to use it. Slick has several dependencies who use dll's to communicate with opengl. You need to specify where those dll's are kept so these dependencies can load the dll's. I found this link that might help you do that..
You also need the native lwjgl library and point to it. The Export Jar functionality do not handle this.
Read up on the lwjgl manual for how to do this.
You have to add your jars either to:
the classpath in your java invocation
the Manifest.mf of your main jar
Java won't automatically load your jars until they are in one of these locations.
Try with File -> Properties -> Java Build Path -> Order and Export

Categories