2013-03-01 97 views
0

我对Java完全陌生,我需要运行一个我从互联网上下载的应用程序。有问题的应用程序是在这里找到的“spinn3r”客户端:http://code.google.com/p/spinn3r-client/downloads/detail?name=spinn3r-client-3.4.06.tar.gz无法运行Java应用程序。主要没有找到

我提取了tar.gz并找到了一个.jar文件。然后我跑:

java -jar applicationName.jar 

我得到以下错误:

no main manifest attribute, in spinn3r-client-3.4.06.jar 

我该如何解决这个问题?

+0

你想要那个jar里面的东西吗?如果是这样,将该jar导入到eclipse中,获取类文件,然后对其进行反编译,以查看该jar正在做什么...... – Ars 2013-03-01 11:27:18

+0

通过在链接的网页上快速查看,看起来并不像可执行文件。它只是一个带有API的库,您可以在开发自己的Java程序时使用它。 – Alderath 2013-03-01 11:30:04

回答

1

正如@Alderath提到的,这主要是一个API,它你可以在你自己的应用程序中使用。尽管如此,jar文件还包含一个test client,你可以启动如下:

$ java -cp spinn3r-client-3.4.06.jar com.spinn3r.api.Main 
Usage: com.spinn3r.api.Main [OPTION] 

Required params: 
... 

由于这是不是一个executable jar文件,你需要通过所需的jar文件,其中包含main方法明确的类。

0

对于一个JAR文件变成可执行的,在META-INF/MANIFEST.MF,在你的罐子,你需要有这个属性:

Main-Class: youclassname.class 
-1

将所有.java文件和.class文件(以及任何其他想包含的文件)一起收集到一个目录中。 使用文本编辑器创建一个包含以下行的文件(比如myManifest):

 Manifest-Version: 1.0 
     Main-Class: MyMainClass 

where MyMainClass is the name of the class containing the main method you want to use. 
From the command line, execute the command: 

    jar cvfm myResult.jar myManifest *.java *.class 

where myResult.jar is the jar file you are trying to create, myManifest is the file you created in step 2, and everything else is the files you want to include. 
+0

-1,实际上并没有回答这个问题:问题是关于(库)jar,而不是TS创建的应用程序。 – 2013-03-01 11:46:58

相关问题