Search This Blog

Thursday, May 20, 2010

Importing VARNA into Eclipse, Jar files

I was trying to look at the VARNA source code last night, but it was in a JAR file. I tried to find a JAR file plugin for Eclipse, but I couldn't get it to work. I tried JadEclipse.

I ended up using the jar command in unix to unzip the file and copy it into Eclipse. I then had a funny Java libray error.

Jim helped me out with importing the VARNA code into Eclipse and fixed the library error I was getting. Jim's instructions are below for interested parties. =)

There are a couple of 'archive viewer' plugins, but in the case of the VARNA source, you don't need any - particularly since the archive actually contains an eclipse project. Here's how to import it and get it running:
1. Open the 'File->Import...' dialog.
2. Choose the 'Existing projects into workspace' entry under the 'General' tab.
3. Select import from archive, and locate the VARNA source archive.
4. Check the VARNA3-1 project and hit the import button!

You'll notice that the project is set up a little differently to the Jalview one (there's no source directory, or lib directory, for instance) - this isn't a problem, but its worth remembering that this is the case when you come to package a VARNA jar for Jalview.

The next steps are necessary to get the Java references set up correctly, since you'll have a different version of Java on your system to the one that the archive was exported from.

5. a. Right click the new project (VARNA3-1 probably), and select the 'configure build path' option under the 'Build path' menu.
5.b. fix up the broken reference to the JDK in the 'Libraries' tab - select the entry with an 'x' and hit edit, then pick the JDK which you have on your system (probably java 1.6).
5.c. Select the 'source folders' tab, and select the 'src' folder and remove it from the list.
5.d. hit the 'Add folder' button and select the project's root directory as a source folder to add to the path.
5. e. Check the 'allow output folders for source folders
5. f. Change the default output directory from VARNA3-1/bin to VARNA3-1/
6. hit ok, and the project should rebuild itself with the new settings, with any luck you'll have no errors.

After this, you should be able to run VARNA by locating the fr.orsay.lri.varna.applications.VARNAGUI class and using the 'Run as ... application' menu entry.

No comments:

Post a Comment