Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
torrent file with magnet link
dear people,

I have been trying to torrent a file with the help of magnet links. But without success.
What I have been reading is that you have to add a magnet link to the PluginInterface as it was an URL.

PluginInterface pi = pm.getDefaultPluginInterface();
pi.getDownloadManager().addDownload(new URL("magnet:?xt=urn:btih:...&"));
After this I add all the downloads to a Download Array and when I ask for the amount of items in the array it returns always 0.
How to properly add a new torrent to the download manager? (Magnet link). Or how to fill the downloads array?

This is the whole code where I want to download a torrent:
public static void main(String args) throws IOException, DownloadException {

Properties props = new Properties();
props.put(PluginManager.PR_DISABLE_NATIVE_SUPPORT, "true");
File az_dir = new File("C:\\Users\\Jeanpierre\\Downloads\\");

props.put(PluginManager.PR_APP_DIRECTORY, az_dir.getAbsolutePath());
props.put(PluginManager.PR_USER_DIRECTORY, az_dir.getAbsolutePath());

File doc_dir = new File("C:\\Users\\Jeanpierre\\Downloads\\Downloads\\");

props.put(PluginManager.PR_DOC_DIRECTORY, doc_dir.getAbsolutePath());
PluginManager pm;
pm = PluginManager.startAzureus(
PluginManager.UI_NONE, props);
final PluginInterface pi = pm.getDefaultPluginInterface();
new PluginListener() {
public void initializationComplete() {
try {
pi.getDownloadManager().addDownload(new URL("magnet:?xt=urn:btih:...&"));
} catch (DownloadException e) {
} catch (MalformedURLException e) {
Download downloads = pi.getDownloadManager().getDownloads();

for (Download d : downloads) {
System.out.println("Download: " + d.getName());
System.out.println("ik kom hier2");
if (d.getName().contains("aws")) { dx =
(( d).getDownload();
try {
} catch (DownloadException e) {

public void closedownInitiated() {

public void closedownComplete() {
Can someone please explain me what I am doing wrong or what I am missing.
I tried several java scripts from others but they all failed.

any help would help :D

Thanks in advance,



magnet links are downloaded asynchronously and can take some time to complete (if they complete at all..) A better way to manage this process is to use the plugin interface TorrentManager methods to get a TorrentDownloader for the magnet, then call download() to attempt to download the torrent, then if successful you can add the Torrent using the DownloadManager addDownload( Torrent ) method(s)

Possibly Related Threads...
Thread Author Replies Views Last Post
Photo Vuze downloads more than the file size. Buddyboy 0 2,882 02-24-2019, 02:02 PM
Last Post: Buddyboy
  download history file location snapshot1219 3 8,603 12-11-2018, 03:01 AM
Last Post: snapshot1219

Users browsing this thread: 1 Guest(s)