2014-03-02 37 views
0

在Snark客戶端網站(http://www.staging.threerings.net/snark.html)上,它說實例jar文件以加載客戶端。我提到這個問題在Oracle社區網站(https://community.oracle.com/message/8935199),這導致說你可以實例與jar文件上:實例jar文件(Snark客戶端)

Snark.main(args); 

然而,當我運行我的程序與上面說的主要方法調用,它不顯示我的GUI所有,而是顯示該控制檯:

The Hunting of the Snark Project - Copyright (C) 2003 Mark J. Wielaard 

Snark comes with ABSOLUTELY NO WARRANTY. This is free software, and 
you are welcome to redistribute it under certain conditions; read the 
COPYING file for details. 

    snark: Need exactly one <url>, <file> or <dir>. 
    Usage: snark [--debug [level]] [--no-commands] [--port <port>] 
       [--share (<ip>|<host>)] (<url>|<file>|<dir>) 
     --debug Shows some extra info and stacktraces 
     level How much debug details to show 
       (defaults to 3, with --debug to 4, highest level is 6). 
     --no-commands Don't read interactive commands or show usage info. 
     --port The port to listen on for incomming connections 
       (if not given defaults to first free port between 6881-6889). 
     --share Start torrent tracker on <ip> address or <host> name. 
     <url>  URL pointing to .torrent metainfo file to download/share. 
     <file> Either a local .torrent metainfo file to download 
       or (with --share) a file to share. 
     <dir>  A directory with files to share (needs --share). 

我屆時提及本網站(http://www.klomp.org/snark/),它給了我如何使用客戶端的例子。給出的例子對我來說沒有任何意義,看起來像命令提示符。這是網站上的一個例子:

./snark somefile.torrent 

我一直在這幾個星期,並就如何貫徹魅客戶到我的程序將是巨大的幫助。

回答

0

我不確定你在傳遞什麼args,但它似乎程序沒有得到任何參數,但它需要一些。爲了從你自己的程序模擬顯示您的網站例如,僅編程:

String[] args = { "somefile.torrent" }; 
Snark.main(args); 

如果你想傳遞一個特定的文件,你可能必須使用一個絕對的文件路徑字符串值。重要的是main(args)需要一個代表命令行參數的String數組。所以如果你打算從snark --debug 6的命令行運行Snark,你想args{"--debug", "6"}