Hey, I'm trying to send Tweets via Bukkit, so I've decided to include Scribe (using Eclipse): Code: import org.scribe.builder.ServiceBuilder; import org.scribe.builder.api.TwitterApi; import org.scribe.model.Token; import org.scribe.oauth.OAuthService; // ... public void onEnable() { OAuthService service = new ServiceBuilder() .provider(TwitterApi.class) .apiKey(c_key) .apiSecret(c_secret) .build(); Token requestToken = service.getRequestToken(); getLogger().info(requestToken.toString()); } ... what returns: Code: Error occurred while enabling BukkitSays v0.1 (Is it up to date?) java.lang.NoClassDefFoundError: org/scribe/builder/ServiceBuilder at org.w8l.Main.onEnable(Main.java:20) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:215) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader .java:337) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage r.java:381) at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:257) at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:239 ) at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:383) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:370) at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:199) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:434) at net.minecraft.server.ThreadServerApplication.run(SourceFile:492) Caused by: java.lang.ClassNotFoundException: org.scribe.builder.ServiceBuilder 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 org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:41) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:29) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 11 more Did I miss an something? Is there a "special" way to use external libraries?
Try either including the external library in your compiled .jar or placing it in the plugins folder of your server.
the jar would trip up the server and cause invalid plugin to spam the console on boot. Im not too familiar with how java handles dealing with external libraries when using a jar as a resource, and i have no idea how to go and use a jar as a resource if its in another folder. So when im using another library for my plugins, i set it up to extract the source files into my jar whenever i compile.
Wow, I'm having this exact same problem with another library.. I need an answer too Edit: Oh, hello: How do you manage to go about that? I use eclipse and can't find an option like that.
You need to make sure your external library is on the classpath however you want to achieve that. Either shading it into your jar using maven or altering the way the server launches to include an additional location for libraries.
I'm still having problems. I made a folder called lib in the root of my project, put the jar file in it, and added it to my resources, and I still get the same error. :c It says it is in my classpath, (at least the .classpath file that is generated in the jar...)
It's not really clear what you're doing, but it's clear that's not working. You have a few options: Use Maven to build your project, and shade the external library into your plugin. Probably the cleanest option and certainly easiest for your users. If you have source for the external library, copy/paste that into your plugin source (modifying its package to some subpackage of your plugin). Easy for your users, not so nice for you to maintain. Keep the external JAR separate from your plugin. You can have your plugin auto-download the external JAR if necessary, and put it in the bukkit/lib folder (if you don't do this, I guarantee you'll be hand-holding your users as they try to install the dependency themselves ). You'll need to add something like Class-Path: ../lib to your JAR's META-INF/MANIFEST.MF to ensure the dependency is picked up. Option 1) is really the best way to go.