Class-path : Could not load x in folder 'plugins'

Discussion in 'Plugin Development' started by To175, Jan 24, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    To175

    Hi, big issues with my plugin :( help me please :)

    1st I set the build path with htmlunit.jar

    2nd I did imports etc...

    3rd created the file
    There is :
    I tried with ./ and ../ both doesn't work.

    #4 when I export I do "using existing manifest from workspace"

    #5 I put htmlunit.jar in "lib" folder.

    The error :
    ERROR (open)
    [18:24:10] [Server thread/INFO]: Set PluginClassLoader as parallel capable
    [17:15:57] [Server thread/ERROR]: Could not load 'plugins/Mecraft.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/WebClient
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:341) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:263) [craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:369) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:152) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:458) [craftbukkit.jar:git-Spigot-1642]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Spigot-1642]
    Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/WebClient
    at fr.mecraft.Mecraft.MeClass.<init>(MeClass.java:83) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[?:1.7.0]
    at java.lang.Class.newInstance0(Class.java:372) ~[?:1.7.0]
    at java.lang.Class.newInstance(Class.java:325) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1642]
    ... 6 more
    Caused by: java.lang.ClassNotFoundException: com.gargoylesoftware.htmlunit.WebClient
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[?:1.7.0]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[?:1.7.0]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[craftbukkit.jar:git-Spigot-1642]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[?:1.7.0]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[?:1.7.0]
    at fr.mecraft.Mecraft.MeClass.<init>(MeClass.java:83) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[?:1.7.0]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.7.0]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[?:1.7.0]
    at java.lang.Class.newInstance0(Class.java:372) ~[?:1.7.0]
    at java.lang.Class.newInstance(Class.java:325) ~[?:1.7.0]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[craftbukkit.jar:git-Spigot-1642]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1642]
    ... 6 more
     
  2. Offline

    To175

    Ok, now I have a good MANIFEST.MF (with good class-path) !
    Every .jar of htmlunit folder are in build path + lib folder.

    Still same error :(
     
  3. Offline

    To175

    Hello, help me please :(
    => Imports √ (all imports needed)
    => BuildPath √ (all .jar of htmlunit folder)
    => Manifest √ (2 jar per line, full path)

    What else ?? :'(
     
  4. Offline

    1Rogue

    You need to include your dependency's files with the jar you are exporting.
     
  5. Offline

    To175

    @1Rogue HOW ???
    I JUST Exported my jar with plugin.yml and config.yml Whaaat else ???
     
  6. Offline

    1Rogue

    To be honest I would use maven (with shade), as manually managing dependencies and jarfile information is a lot of setup-specific work and is not very portable.
     
  7. Offline

    To175

    @1Rogue
    Yaayy thanks ! I just wanted to ask you, how to use Maven :p
    Which one I have to download please ?
    I just have to put maven.jar in "plugins" and to add it in build path ? That's all ?
     
  8. Offline

    1Rogue

    No, maven has nothing to do with build paths. It replaces any need to mess with build paths and jarfile manifests entirely. Maven will do the compiling of your plugin for you.

    Maven usually has integrated support in any decent (note: Not eclipse) IDE. As for getting started: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html (skip the command-line command in "creating a project", your IDE can do that part).
     
  9. Offline

    To175

    @1Rogue
    thanks,
    pc2:~ THEO$ mvn --version

    Erreur : impossible de trouver ou charger la classe principale org.codehaus.plexus.classworlds.launcher.Launcher
     
    Last edited: Feb 2, 2015
  10. Offline

    1Rogue

    Are you running maven from the command line or is that an output from your IDE?
     
  11. Offline

    To175

    @1Rogue
    "pc2:~ THEO$" is the prefix in Terminal.app of all commands... I don't know what you mean
    And terminal is returning me :
    Erreur : impossible de trouver ou charger la classe principale org.codehaus.plexus.classworlds.launcher.Launcher
     
  12. Offline

    1Rogue

    Yeah, it cannot find the main class when you use Terminal. What IDE do you use?
     
  13. Offline

    To175

    I use jdk1.7 and I configured the Java home here ! :p
    @1Rogue

    Hum however in fact I can't found the right path to maven...... It is said to write :
    export PATH=$PATH:/usr/local/apache-maven/apache-maven-3.2.5/bin
    HOWEVER
    apache-maven-3.2.5/bin
    ..... bin folder doesn't exist here O.O


    can't it be an issue with class-path relatives ?

    :(
     
    Last edited: Feb 3, 2015
  14. Offline

    1Rogue

    Your PATH is a system variable that tells things such as your command line where to find executables. So instead of typing
    Code:
    /usr/local/apache-maven/apache-maven-3.2.5/bin/maven -options
    You can do:
    Code:
    maven -options
    However the point I'm trying to stress is this: You don't need to do this on the command line. If you use an IDE for writing your code it usually is integrated with maven. In rusty french:

    Si tu utilizeras un «IDE» pour écrire ton code, alors tu n'est pas nécessaire de le faire sur la «command line»
     
Thread Status:
Not open for further replies.

Share This Page