2013-03-01 119 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

相關問題