Java 实例jar文件(Snark客户端)
在Snark客户端网站()上,它说要实例化一个jar文件以加载客户端。我在oracle社区网站()上提到了这个问题,这导致我们说您可以通过以下方式来实例jar文件:Java 实例jar文件(Snark客户端),java,oracle,client,bittorrent,Java,Oracle,Client,Bittorrent,在Snark客户端网站()上,它说要实例化一个jar文件以加载客户端。我在oracle社区网站()上提到了这个问题,这导致我们说您可以通过以下方式来实例jar文件: Snark.main(args); 但是,当我使用上面的主方法调用运行程序时,它根本不显示我的GUI,而是在控制台中显示: The Hunting of the Snark Project - Copyright (C) 2003 Mark J. Wielaard Snark comes with ABSOLUTELY NO W
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).
我在这方面已经做了几周了,关于如何在我的程序中实现snark客户端的任何帮助都将是非常好的。我不确定您传递的是
args
,但程序似乎没有得到任何参数,但它需要一些参数。为了模拟您展示的网站示例,请仅从您自己的程序以编程方式:
String[] args = { "somefile.torrent" };
Snark.main(args);
如果要传入特定文件,则可能必须为字符串值使用绝对文件路径。重要的一点是main(args)
采用表示命令行参数的String
数组。因此,如果要使用Snark--debug 6
从命令行运行Snark,那么args
应该是{--debug”,“6”}
String[] args = { "somefile.torrent" };
Snark.main(args);