Question: Problem with biojava.core.jar
gravatar for ewa_kania-15
5.6 years ago by
United Kingdom
ewa_kania-150 wrote:


I am working with Biojava and I am trying to run CookbookMSA. I have all requested jars, but I get an error 

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.biojava3.core.sequence.location.SimpleLocation
    at org.biojava3.alignment.SimpleAlignedSequence.setLocation(
    at org.biojava3.alignment.SimpleAlignedSequence.<init>(
    at org.biojava3.alignment.SimpleProfile.<init>(
    at org.biojava3.alignment.SimpleSequencePair.<init>(
    at org.biojava3.alignment.SimpleSequencePair.<init>(
    at org.biojava3.alignment.routines.AnchoredPairwiseSequenceAligner.setProfile(
    at org.biojava3.alignment.template.AbstractMatrixAligner.align(
    at org.biojava3.alignment.template.AbstractPairwiseSequenceAligner.getPair(
    at org.biojava3.alignment.FractionalIdentityScorer.align(
    at org.biojava3.alignment.FractionalIdentityScorer.getMaxScore(
    at org.biojava3.alignment.template.AbstractScorer.getDistance(
    at org.biojava3.alignment.template.AbstractScorer.getDistance(
    at org.biojava3.alignment.GuideTree.<init>(
    at org.biojava3.alignment.Alignments.getMultipleSequenceAlignment(
    at Alignment.multipleSequenceAlignment(
    at Alignment.main(


I am woking on latest version of Eclipse Luna, Windows System. My code is:


import java.util.ArrayList;
import java.util.List;
import org.biojava3.alignment.Alignments;
import org.biojava3.alignment.template.Profile;
import org.biojava3.core.sequence.ProteinSequence;
import org.biojava3.core.sequence.compound.AminoAcidCompound;
import org.biojava3.core.util.ConcurrencyTools;
public class Alignment {
    public static void main(String[] args) {
        String[] ids = new String[] {"Q21691", "O48771"};
        try {
        } catch (Exception e){
    private static void multipleSequenceAlignment(String[] ids) throws Exception {
        List<ProteinSequence> lst = new ArrayList<ProteinSequence>();
        for (String id : ids) {
        Profile<ProteinSequence, AminoAcidCompound=""> profile = Alignments.getMultipleSequenceAlignment(lst);
        System.out.printf("Clustalw:%n%s%n", profile);
    private static ProteinSequence getSequenceForId(String uniProtId) throws Exception {
        URL uniprotFasta = new URL(String.format("", uniProtId));
        ProteinSequence seq = FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId);
        System.out.printf("id : %s %s%n%s%n", uniProtId, seq, seq.getOriginalHeader());
        return seq;

What might be a problem?

alignment biojava • 2.0k views
ADD COMMENTlink modified 4.6 years ago by Biostar ♦♦ 20 • written 5.6 years ago by ewa_kania-150

Hi, a bit of your code and info on the platform and OS would help a lot. Thank you!

ADD REPLYlink written 5.6 years ago by RamRS26k

I have added code

ADD REPLYlink written 5.6 years ago by ewa_kania-150
gravatar for Jose Manuel Duarte
5.4 years ago by
Jose Manuel Duarte290 wrote:

This is a bit old, but anyway I've just seen it and maybe it can still help: NoClassDefFoundError indicates there's something wrong in your classpath, i.e. the jar files that you need for your code to link to biojava at runtime. 

How are you getting the jar files? manually? with maven?

If you are working in eclipse with manual downloading of jars, you need to make sure that the classpath is correctly set: right click on project root, select "Build Path", then "Configure Build Path..." and then the "Libraries" tab. There you have to refer to all the jars needed for Biojava (one per module) and eventually any other dependencies needed by Biojava itself.

Setting it up manually might be a bit tedious, that's why it is recommended to use maven, check the readme in here for how to set maven up to work with biojava.

ADD COMMENTlink written 5.4 years ago by Jose Manuel Duarte290
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1981 users visited in the last hour