Want to download torrents via bt-cli. I tryed to launch bt-cli as module of bt parent and launch bt-cli-demo as project, but I aslways get java.nio.file.AccessDeniedException to temp files.
I tryed through Intellij Idea and through shell, all time the same problem.
Also tryed to dowload with -f and with -m keys (link to the project and keys description https://github.com/atomashpolskiy/bt)
I always get the same exception: exception screen
Maybe I have to change folder for temp files, but I don't know to do it
Code:
public static void main(String[] args) throws IOException {
Options options;
try {
options = Options.parse(args);
} catch (OptionException e) {
Options.printHelp(System.out);
return;
}
configureLogging(options.getLogLevel());
configureSecurity();
registerLog4jShutdownHook();
CliClient client = new CliClient(options);
client.start();
}
all params I get from shell, api parses it and create configureation according income params. Then it starts.
Params for shell:
static {
parser = new OptionParser() {
{
acceptsAll(Arrays.asList("?", "h", "help")).isForHelp();
}
};
metainfoFileOptionSpec = parser.acceptsAll(Arrays.asList("f", "file"), "Torrent metainfo file")
.withRequiredArg().ofType(File.class);
magnetUriOptionSpec = parser.acceptsAll(Arrays.asList("m", "magnet"), "Magnet URI")
.withRequiredArg().ofType(String.class);
targetDirectoryOptionSpec = parser.acceptsAll(Arrays.asList("d", "dir"), "Target download location")
.withRequiredArg().ofType(File.class)
.required();
shouldSeedOptionSpec = parser.acceptsAll(Arrays.asList("s", "seed"), "Continue to seed when download is complete");
sequentialOptionSpec = parser.acceptsAll(Arrays.asList("S", "sequential"), "Download sequentially");
enforceEncryptionOptionSpec = parser.acceptsAll(Arrays.asList("e", "encrypted"), "Enforce encryption for all connections");
verboseOptionSpec = parser.acceptsAll(Arrays.asList("v", "verbose"), "Enable more verbose logging");
traceOptionSpec = parser.accepts("trace", "Enable trace logging");
inetAddressOptionSpec = parser.acceptsAll(Arrays.asList("i", "inetaddr"), "Use specific network address (possible values include IP address literal or hostname)")
.withRequiredArg().ofType(String.class);
torrentPortOptionSpec = parser.acceptsAll(Arrays.asList("p", "port"), "Listen on specific port for incoming connections")
.withRequiredArg().ofType(Integer.class);
dhtPortOptionSpec = parser.accepts("dhtport", "Listen on specific port for DHT messages")
.withRequiredArg().ofType(Integer.class);
shouldDownloadAllFiles = parser.acceptsAll(Arrays.asList("a", "all"), "Download all files (file selection will be disabled)");
}
/**
* @throws OptionException
*/
public static Options parse(String... args) {
OptionSet opts = parser.parse(args);
return new Options(
opts.valueOf(metainfoFileOptionSpec),
opts.valueOf(magnetUriOptionSpec),
opts.valueOf(targetDirectoryOptionSpec),
opts.has(shouldSeedOptionSpec),
opts.has(sequentialOptionSpec),
opts.has(enforceEncryptionOptionSpec),
opts.has(verboseOptionSpec),
opts.has(traceOptionSpec),
opts.valueOf(inetAddressOptionSpec),
opts.valueOf(torrentPortOptionSpec),
opts.valueOf(dhtPortOptionSpec),
opts.has(shouldDownloadAllFiles));
}