有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

jar java。lang.ClassNotFoundException:org。restlet。服务隧道服务命令行

我正在使用Restlet框架

我正在尝试从使用Eclipse创建的jar文件运行我的项目,方法是:Export->;运行JAR文件,并选择选项将所需库打包到生成的JAR中

但是,当我试图在命令行中执行jar文件时,键入:

java -Djava.security.policy=Client.Policy -jar identiscopeRunnable.jar 

我得到以下信息:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: org/restlet/service/TunnelService
at rest.IdentiscopeServer.main(IdentiscopeServer.java:24)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.restlet.service.TunnelService
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more

我已经将从Restlet框架下载的所有jar文件添加到了我的项目中,所以我认为它们没有问题。有人对此有任何线索吗

万一有人问IdentiscopeServer.java的第24行是:

IdentiscopeServerApplication identiscopeServerApp = new IdentiscopeServerApplication();

IdentiscopeServerApplication基本上是这样做的:

@Override
public Restlet createInboundRoot() {
    Router router = new Router(getContext());

    //attaches the /tweet path to the TweetRest class
    router.attach("/collectionPublic", CollectionPublicREST.class);
    router.attach("/collectionPrivate", CollectionPrivateREST.class);
    router.attach("/analysis", AnalysisREST.class);
    return router;
}

共 (0) 个答案