2014-03-02 2 views
0

Snark 클라이언트 웹 사이트 (http://www.staging.threerings.net/snark.html)에는 클라이언트를로드하기 위해 jar 파일을 인스턴스로 지정합니다. 난 당신이 인스턴스 jar 파일 수 없다는 이어질 오라클 커뮤니티 웹 사이트 (https://community.oracle.com/message/8935199)에이 질문에 언급 : 내가 위에서하는 주요 메소드 호출 내 프로그램을 실행할 때인스턴스 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을 snark --debug 6과 함께 실행하려면 args{"--debug", "6"}이되어야합니다.