Java compile error of example code

1 view
Skip to first unread message

ke lin

unread,
Mar 31, 2010, 12:38:54 PM3/31/10
to bridgedb-discuss
I'd like to use bridgedb to map some identifiers to another resources.
I followed all the instructions in the doc and include all the
libraries in dist. But it still can't compile in java. The code and
error message can be found below:

import org.bridgedb.Xref;
import org.bridgedb.bio.BioDataSource;
import org.bridgedb.*;
import org.bridgedb.IDMapper;

public class BridgedbTest {

public static String[] bridgetest(){
String[] resultlist;
int resultidx = 0;
Class.forName("org.bridgedb.webservice.bridgerest.BridgeRest");
BioDataSource.init();

// now we connect to the driver and create a IDMapper instance.
IDMapper mapper = BridgeDb.connect ("idmapper-bridgerest:http://
webservice.bridgedb.org/Human");

// We create an Xref instance for the identifier that we want to look
up.
// In this case we want to look up Entrez gene 3643.
Xref src = new Xref ("3643", BioDataSource.ENTREZ_GENE);

// let's see if there are cross-references to Ensembl Human
Set<Xref> dests = mapper.mapID(src,
DataSource.getBySystemCode("EnHs"));

// and print the results.
// with getURN we obtain valid MIRIAM urn's if possible.
for (Xref dest : dests){
resultidx ++;
resultlist[resultidx] = " " + dest.getURN();
}
}

}


Errors:
BridgedbTest:22: cannot find symbol
symbol : class Set
location: class BridgedbTest
Set<Xref> dests = mapper.mapID(src,
DataSource.getBySystemCode("EnHs"));
^
1 error

Martijn van Iersel

unread,
Apr 1, 2010, 5:51:14 AM4/1/10
to bridgedb...@googlegroups.com
Dear Ke Lin

"Set" is in the package java.util. Add the following line to fix the error:

import java.util.Set;

btw, this is not a BridgeDb related problem, this is normal Java coding
mistake.

regards,
Martijn

Reply all
Reply to author
Forward
0 new messages