Search This Blog

Thursday, May 13, 2010

Using Eclipse as an IDE

I'm still getting used to Eclipse. After watching Jim use it over skype it looks like it will make my life easier in the long run. For anyone who wants to learn how to use it, here is a brief tutorial:

https://eclipse-tutorial.dev.java.net/eclipse-tutorial/part1.html

Getting Jalview to compile properly in eclipse was a bit more tricky than I thought - Jim helped me out. First, I followed directions from a post in the jalview-discuss mailing list:

1. Create a new project where you have (at least in eclipse) specified a
distinct source folder called 'src', and a distinct build folder called
'classes'.


To do this in eclipse, you can do this when you first create the project by clicking on the "Create separate folders for sources and class files" option and going to "configure defaults." Here you can indicate that the output folder should be called "classes." If you have already created the project, right-click the Jalview folder and select "Properties." Then go to Java Build Path, select the Source tab and select the default output folder (or create the output folder).


2. Unpack the source distribution and copy all the files under jalview/
into the new project's folder. This will overwrite the src directory
with the one of the same name containing jalview's source.


I did this simply by dragging the files over into eclipse under the jalview project that I had created.


3. Configure your project's build and runtime dependencies
- all the dependencies needed to run jalview are in
jalview/lib
- Use the ant build script (jalview/build.xml) to
build jalview
* for this to work correctly, add jalview/utils to the
ant classpath and the build classpath to resolve the
remaining compile-time dependencies
- look at the output of the default build target to see
what each ofthe different targets do.
You need to add jalview/lib and jalview/utils to the buildpath. This is discussed in the eclipse tutorial I posted above. To do this, right click on the jalview folder and go to "Properties." Click on "Java Build Path" and the "Source" tab. Now you can add the folders lib and utils by clicking on the "Add folder" button.

The tutorial also goes over how to add JAR files. I wasn't sure if it was necessary in this case but I did it anyway. Click on the "Libraries" tab and click on "Add JARS." There are JARS in the lib and utils folders that you can add.

Lastly, you need to make sure to import the builder correctly. In the Project Menu bar, go to "Properties", click on "Builders." If you don't see Jalview build.xml [Builder], then you need to add it. Do this by:

1. build.xml is one of the files in the Jalview source that is not in a folder. Right click on it and go to "Properties."
2. In the Build tab, uncheck "Build before launch." You may need to click on "Run/Debug Settings" and click on Jalview Build.xml to get to this view.
3. In the Targets tab, uncheck usage, check "build indices"
4. In the Classpath tab, make sure that the jalview/utils and jalview/lib have been added
5. click apply

Go to Project Menu > Properties. Import the Jalview builder. Move it up in priority (maybe not too crucial).

To run Jalview, in Jalview/bin, right click Jalview.java and select run as application!

No comments:

Post a Comment