我正在使用http://tumblr.github.io/jumblr/中的“Jar with dependencies”构建
编码:
import com.tumblr.jumblr.JumblrClient;
public class App {
public static void main(String[] args) {
// Authenticate via OAuth
JumblrClient client = new JumblrClient(
"xyz",
"xyz"
);
client.setToken(
"xyz",
"xyz"
);
}
}
编译时是否使用 Tumblr 中的实际密钥并不重要
javac -cp jumblr-0.0.6-jar-with-dependencies.jar App.java
当我运行它时
java App
它提出了
Exception in thread "main" java.lang.NoClassDefFoundError: com/tumblr/jumblr/JumblrClient
at App.main(App.java:7)
Caused by: java.lang.ClassNotFoundException: com.tumblr.jumblr.JumblrClient
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
我已将 jumblr-0.0.6-jar-with-dependencies.jar 放在与 App.java 相同的文件夹中。
关于例外的任何想法?