Plugin Development Guide: Running the plugin
Now that we've got a plugin, let's try and run it in Azureus. We could build the plugin and export to a JAR file (which we'll actually cover in the next step), but running Azureus from Eclipse will let you just test your code changes much easier, rather than having to continually build and install the plugin into Azureus.
So we're going to configure Azureus to run from Eclipse - this is useful because Eclipse will pull the class files from your plugin project.
- So, first of all, you have to configure a Run command in Eclipse to run Azureus.
- Create a new Java Application. The first thing to do is to go to the Classpath tab and import two external JAR files - Azureus2.jar and swt.jar - you can link to JAR files in your current Azureus installation.
- This is an optional step - if you want this Azureus instance to use its own separate configuration settings, you can set the path to store the setting files here in the VM arguments section by entering -Dazureus.config.path=<somepath>. There's more information about other options to set here.
- In the Main tab, set the main class to be org.gudy.azureus2.ui.swt.Main.
- Now you can run Azureus. However, if you go to the Options -> Plugins page, you will see that the Aizen plugin isn't actually listed. That's because Azureus hasn't found the plugin.properties file - it needs to exist in one of the plugin directories (the "shared" and "per-user" directories are listed at the top of the Plugins page.
- You can click on either one of the directories linked at the top of the page to get to the plugins directory. Create a subdirectory in that location (probably best to give the subdirectory the same name as the plugin ID - which is aizen in this case).
- Copy the plugin.properties file from your Eclipse project into this subdirectory - you should be able to drag and drop it from Eclipse. The presence of this file will mean Azureus will know to try and load the plugin. It's not necessary to update this copy of the plugin.properties file every time you want to create a new version - it only needs to be present to get Azureus to detect it.
- Now if we run Azureus again, and look on the Plugins options page, you should see that the plugin is listed!
That's all you need to be able to run Azureus with any changes in the plugin being reflected in the program. This is assuming that you've got the auto-build setting enabled in Eclipse (Project -> Build Automatically), otherwise you'll have to build the project manually each time before you run it.
Of course, at some point, you'll want to share the plugin with others, so you will have to then build it...