[Biojava-l] Setup problems on Linux

mark.schreiber at novartis.com mark.schreiber at novartis.com
Wed Jul 26 03:33:33 UTC 2006

What is the specific problem? I assume you are getting some sort of 
ClassNotFound exception but it's hard to know what is going wrong without 
an example.

To make sure your CLASSPATH variable is actually being set you could try


What comes back should be what you set it to. If you get a blank line for 
some reason it is not set.

Note that you also need to set the classpath to include the classes or jar 
of any program you compiled yourself. Hence if you compiled a program 
called Main.class from a package called examples and it is in 
/usr/home/me/myprogram/classes/examples you need to append 
/usr/home/me/myprogram/classes to your classpath.

There are lots of ways to do this. One of my favourites is to make a 
script to setup the classpath and execute the program all in one go.

something like

#! /bin/bash

#basic biojava

#classes for my program
export CLASSPATH=$CLASSPATH:/usr/home/me/myprogram/classes/

#run the program
java examples.Main

Make this shell script executable and run it.

You may find that as you get more java experience you will end up with 
some projects having huge numbers of jar dependencies and possibly 
projects that require different versions of jars, for example some 
programs might be fine with biojava1.4 some may need biojava-live. By 
setting your classpath in the script you keep everything seperate and 
don't end up with a mammoth environment variable with possible naming 

Another way to do it is to put commonly used CLASSPATHs in your .bashrc 
with different names.


export CLASSPATH=/usr/jars/default.jar
export CLASSPATH_BIOJAVA=/usr/biojava/biojava.jar:/usr/biojava/blah

and then from the java command line you can do this neat trick

java myproject.Main (runs Main.class from the myproject package with the 
default classpath)
java -cp $CLASSPATH_MYAPP myapp.MainApp (runs MainApp.class from the myapp 
package with the MYAPP classpath)
java -cp $CLASSPATH_BIOJAVA_DEMOS demo.Demo1 (runs Demo1.class from the 
demo package with the BIOJAVA_DEMO classpath)

Hope this helps,

- Mark

Mark Schreiber
Research Investigator (Bioinformatics)

Novartis Institute for Tropical Diseases (NITD)
10 Biopolis Road
#05-01 Chromos
Singapore 138670

phone +65 6722 2973
fax  +65 6722 2910

"Bornman, Daniel M" <bornmand at battelle.org>
Sent by: biojava-l-bounces at lists.open-bio.org
07/26/2006 04:16 AM

        To:     biojava-l at lists.open-bio.org
        cc:     (bcc: Mark Schreiber/GP/Novartis)
        Subject:        [Biojava-l] Setup problems on Linux

Dear Listers,

I am having problems getting my biojava-1.4 set up on my linux machine.
I have java2-sdk-1.4.2 working just fine.  I also have a working install
of biojava on my windows machine so I'm surprised to have ran into such
a problem.

I put all the .jar files in a directory '/usr/local/biojava' and set the
permissions to each of the .jar files to 755.  I am using a bash shell
so I inluded a command in my bash_profile to inlcude the jar files in
the CLASSPATH variable.
(i.e. export
blah blah...)

Also, mozilla browser forced the jar files to be saved with a .zip
extension. So I downloaded a .zip version and a .jar version of each of
the jar files and tried each of these extensions set in the bash_profile
with no luck. Argh!

Does someone have an idea of what I can try next???

Thank You,

Daniel Bornman
Battelle Memorial Institute
505 King Ave
Columbus, OH 43201

Biojava-l mailing list  -  Biojava-l at lists.open-bio.org

More information about the Biojava-l mailing list