This page gives a step by step description of running the Vuze/Azureus BitTorrent client in the Eclipse IDE. This has been tested with Vuze 18.104.22.168 source code and Eclipse 3.7 (Indigo).
Note: This article was almost completely rewritten in April 2010 to reflect the change to the SVN source code repository (from the old CVS).
- Download Eclipse and extract the archive to a directory of your choice
- Start the Eclipse launcher (the actual file name depends on the OS) and choose a location for the workspace (the default path should be ok)
- Under Window > Preferences, tweak the following settings:
- Java > Build Path: select Folders and clear the source folder box and make sure "bin" is in the output folder box.
- click on OK and go to the Project Menu and unselect Build Automatically (Eclipse will build the project anyway when you use the Run option)
Set up SVN Functionality
To load Vuze into Eclipse for editing, the first thing you should do is set up SVN client functionality. That can be be done easiest by installing Subclipse. Subclipse will add SVN functionality to Eclipse. It can be installed through Eclipse's update system.
- When installing Subclipse, make sure that you are running Eclipse with Admin rights. Subclipse plugin will not work, if you install it to your Eclipse profile directory. It needs to be in Eclipse's global plugin directory. Especially if you are running Windows Vista or Windows 7, make sure that during the install you run Eclipse with "Run as administrator" and the plugin gets installed into glocal plugin directory. (If you run Eclipse normally, the plugin ends up to your personal Eclipse plugin directory.) Same advice for Linux. See here: http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1047&dsMessageId=2625924
- Possible locations for org.tigris.subversion.subclipse.ui_1.6.17.jar and other plugin components:
- Wrong place: C:\Users\<username>\.eclipse\org.eclipse.platform_3.6.1_920333535\plugins
- Correct place: C:\Program Files\Eclipse\plugins
- This is tricky. I have now twice been burned with the issue with Eclipse updates, and it always takes some time to figure it out...
- If you install Subclipse to a 64-bit Eclipse running with 64-bit-java in Windows, you need to fetch an additional JavaHL library. See advice here: http://subclipse.tigris.org/wiki/JavaHL . You can get it e.g. from here: http://www.sliksvn.com/en/download
That way you can easily get the latest code.
SVN Subversion 1.7
Please note that Subversion 1.7 has a different storage format for working copies than the earlier 1.0-1.6 versions. An 1.7 client can't operate 1.6 working copies, and an 1.6 client does not understand 1.7 copies. The 1.6 working copies can be converted to 1.7 format with the 1.7 client. (The server side is still compatible.) If you use several SVN clients (like Subclipse in Eclipse and TortoiseSVN generally in Windows), make sure that you update all your SVN clients at the same time.
Subclipse SVN 1.7 for Eclipse can be found by defining the installation site http://subclipse.tigris.org/update_1.8.x in Eclipse (instead of the update_1.6.x).
Import Vuze source code
Lets walk through the steps in getting the actual source code.
- Note (unconfirmed information): If you are using Windows7, disable indexing, because it causes error (file cannot be accessed)
- Open up the SVN Repository perspective in Eclipse. You can do that by going to Window > Open Perspective > SVN Repository Exploring. If the SVN Repositories view is not showing, click on Window > Show View > SVN Repositories.
- Right click in the SVN perspective, and choose New > Repository Location. You will be presented with the Add a new SVN Repository dialog. There is only one field you need to fill in:
- When the repository is shown in the view, select Checkout... from the context menu.
- Select Check out as a project using the New Project Wizard, (make sure that you are checking out the HEAD revision and Depth is fully recursive) and click on Finish
- In the New project popup window select Java > Java Project, continue
- Enter a Project name, i.e. "AZ-SVN" and select create new project in workspace and create separate source and output folders (the .class files will be placed in a different output folder instead in the same folders as the sourcecode)
- Finish the wizard by accepting defaults in Java settings. If you set the global output folder option properly, the wizard should suggest now the /bin subdirectory as output folder.
When the download of the sources is completed you can change to the Java Perspective (Window > Open Perspective > Java), adding the Navigator view could be useful to explore the project's file structure. Eclipse might also do that automatically.
Configure the Project
Vuze structure of having the source code in three separate trees makes things a bit challenging, and you need to change the Java build path a bit.
Once you're in the java perspective you should do the following things:
- Go to the Navigator tab
- Right-click on the project > Properties > Java Build Path
- Go to the Source tab, and
- Remove the default inclusion of all project sources (e.g. AZ-SVN).
- Add the three proper source tree folders: /azureus2/src/, /azureus3/src/ and /uis/src/
- Also check the output folder stated on the bottom is "project_name/bin"
- Then go to Libraries tab, and select Add JARs..., select all .jar libraries from your project trees /azureus2/lib/ and /uis/lib/. Add all those selected .jar files by selecting Ok. (Note: the library AppleJavaExtensions.jar was removed in May 2010 in version 22.214.171.124.)
- (Note, unconfirmed info: xosx.jar causes error in windows systems, dont include that.)
Eclipse should be able to compile your project now, you can manually start a build process via Right-click > Build Project'
Configure the Run dialog
- Go to the Navigator tab
- Right-click on the project > Run configurations
- Select Java application, click on New and give it a name (i.e. the same as the project name)
- On the "Main" tab,
- Select the correct project manually or using Browse
- Put "org.gudy.azureus2.ui.swt.Main" into the Main class box.
- Go to the Arguments tab and deselect the Default checkbox on the bottom and put the path of your installed Azureus version in Other as the working directory if you want to reuse the installed plugins and/or sub-directories created by plugins. This enables you to use your existing Vuze configuration & environment. The correct working directory for the mac is /Applications.
- Mac only: put -XstartOnFirstThread into VM arguments field.
- Note: If you don't have a pre-built version of Azureus you'll need to download the swt-libs for your OS from the Eclipse website and put them into the specified working directory. It might be a good idea to create the working directory outside the workspace since the core plugins will be installed in it.
- Go to the Classpath tab and add the swt.jar from your installed Azureus version/working directory through Add External JARs... to the User Entries. (If you are building this using 64-bit Eclipse your Vuze installation also needs to be 64-bit. It probably isn't, or at least you have both 32bit and 64bit Javas. Regarding running Vuze, the tricky part is having both 32bit and 64bit swt.jars coexist side by side. One solution is to have swt.jar for your default java architecture, and then renamed copies e.g. swwt32.jar and swwt64.jar, so that you can point Eclipse to use the correct one.)
- Go to the Environment tab and add Variable LD_LIBRARY_PATH with the Value of your output folder (/bin subdirectory to the project, if you followed the previous advice).
- Save settings with Apply and finally select Run.
Building an Azureus2.jar
- Go to the Navigator tab
- If you haven't built the project yet: Right-click on the project > Build Project
- Right-click on the project > Export...
- Go to the export tab and select Java > JAR file.
- In the next step:
- Select your Project in the Select resources to export field
- Only this checkbox hould be checked: Export all output folders for checked projects
- Select the output folder (=export destination) for your Azureus2.jar, i.e. inside the workspace or your azureus program/working directory (see #Configure the Run dialog). Note that you can also give another name to the .jar file to generated.
- Enable these options: compress the contents of the jar file and add directory entries
- If you have to build .jar files frequently you can go to the next page and overwrite the Azureus2.jardesc in your project root folder
To rebuild the .jar file Right-click on the Azureus2.jarfile in the Package Explorer and select Create jar
- Go to the last page and add org.gudy.azureus2.ui.swt.Main as main class. (You can use the Browse button and then write main to find the class easily)
- Finish the dialog and wait until the .jar file is build
Synchronizing with the SVN repository
- Go to the Navigator tab (or any other tab showing Team in context menu)
- Right-click on the project > Team > Update to HEAD (it may change to the Team sychnoronize perspective now or open the Synchronize tab)
- Should you want to update to a certain older version, you can select Update to Version....
Old CVS related:
- Wait until Eclipse has found all differences
- Click on the Incoming Mode button if you want to see what has changed
- Click on the Update all incoming changes... button to update
- In case you have modified files and the same files have been changed in the CVS too continue with the following steps:
- Click on the Conflicts Mode button
- Double-click on the conflicting file(s) to open the Compare Editor
- Now you can what differs on both sides, since you don't have CVS write access you can only import incoming changes, either do that manually by clicking on the square in the middle bar for each incoming change or simply click on the Copy all non-conflicting changes from the right to the left button, of course that only works for differences on that don't conflict with your own changes. If there are such differences you have to rewrite your code manually.
- after you have imported the changes from CVS or modified your own code in a way that matches the CVS changes right-click on the file in the Synchronize tab and select Mark as Merged