0

I'm trying to run a Java command line program from the Windows command prompt to extract and generate an ontology file from the BioPortal (http://bioportal.bioontology.org). It appears that it can't find the class, but perhaps my CLASSPATH parameter syntax is incorrect. Reference for setup (NCBO user guide and NCBO extraction tool zip file) can be found at the bottom of my question. The instructions are based on Linux syntax, but I'm running this in Windows.

Linux command (from user guide):

java -classpath endorsed_lib/*:genlib/i2b2Common-core.jar:lib/commons/*:lib/log4j/*:lib/jdbc/*:lib/spring/*:* edu.harvard.i2b2.ncbo.extraction.NCBOOntologyExtractAll -ont {5 digit ontology id} -apikey {API key from http://bioportal.bioontology.org/account} -outputFileName {output file path}

The Linux -classpath parameter includes these:

endorsed_lib/*
genlib/i2b2Common-core.jar or genlib/* (only 1 jar file)
lib/commons/*
lib/log4j/*
lib/jdbc/*
lib/spring/*
*

Windows command (that doesn't work):

java -cp ".\endorsed_lib;.\genlib;.\lib\commons;.\lib\jdbc;.\lib\log4j;.\lib\spring;." edu.harvard.i2b2.ncbo.extraction.NCBOOntologyExtractAll -ont 47178 -apikey 68775b88-c12f-472c-9192-71f9b282309c -outputFileName 47178_stagingFile.txt

Error from Windows command prompt:

Error: Could not find or load main class edu.harvard.i2b2.ncbo.extraction.NCBOOntologyExtractAll

The Windows -cp (CLASSPATH) parameter includes these paths:

\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\;
\NCBOExtractionTools_1.1\Release_1_1\genlib\;
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\;
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\;
\NCBOExtractionTools_1.1\Release_1_1\lib\log4j\;
\NCBOExtractionTools_1.1\Release_1_1\lib\spring\;
\NCBOExtractionTools_1.1\Release_1_1\;

=================

Guide:

https://community.i2b2.org/wiki/download/attachments/5670011/NCBO_Extraction_Users_Guide_1-1.pdf?version=2&modificationDate=1344357357000

Instructions start on page 8 of 16. I'm on page 9.

In the user guide, it references an NCBO utility. That can be downloaded here:

https://www.i2b2.org/software/download.html?d=310

click the blue hyperlink labeled "file download" or click link below (link as of 1/4/2013) > then click "I ACCEPT" > save file (NCBOExtractionTools_1.1.zip) to your local machine > extract zip file

Here is a list of the files extracted from the i2b2 NCBO utility so you can see what jar files we have available:

\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib
\NCBOExtractionTools_1.1\Release_1_1\ExtractionApplicationContext.xml
\NCBOExtractionTools_1.1\Release_1_1\FileList.txt
\NCBOExtractionTools_1.1\Release_1_1\genlib
\NCBOExtractionTools_1.1\Release_1_1\hierarchy.log
\NCBOExtractionTools_1.1\Release_1_1\i2b2_license_2.1-1159.txt
\NCBOExtractionTools_1.1\Release_1_1\lib
\NCBOExtractionTools_1.1\Release_1_1\log4j.properties
\NCBOExtractionTools_1.1\Release_1_1\NCBOExtraction_1.1.jar
\NCBOExtractionTools_1.1\Release_1_1\STAGING_FILES
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\jaxb-api.jar
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\jaxb-LICENSE.txt
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\stax-api-1.0.1.jar
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\stax-api-LICENSE.txt
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\wstx-asl-3.0.1.jar
\NCBOExtractionTools_1.1\Release_1_1\endorsed_lib\wstx-LICENSE.txt
\NCBOExtractionTools_1.1\Release_1_1\genlib\i2b2Common-core.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc
\NCBOExtractionTools_1.1\Release_1_1\lib\log4j
\NCBOExtractionTools_1.1\Release_1_1\lib\spring
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\apache-2.0license.txt
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-codec-1.3.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-collections-2.1.1.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-dbcp-1.2.2.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-exec-1.0.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-httpclient-3.0.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-logging-1.0.4.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\commons\commons-pool-1.3.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\ojdbc14.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver2005
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver_jTDS
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver2005\sqljdbc.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver2005\sqlserver_licence.rtf
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver_jTDS\jtds-1.2.2.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\jdbc\sqlserver_jTDS\LICENSE
\NCBOExtractionTools_1.1\Release_1_1\lib\log4j\log4j-1.2.8.jar
\NCBOExtractionTools_1.1\Release_1_1\lib\log4j\log4j-LICENSE.txt
\NCBOExtractionTools_1.1\Release_1_1\lib\spring\apachelicence-2.0.txt
\NCBOExtractionTools_1.1\Release_1_1\lib\spring\spring-2.0.jar
JustBeingHelpful
  • 18,332
  • 38
  • 160
  • 245
  • 2
    Those `*`s and file names you left out are kind of important. The classpath has to be the `.jar` files, not a directory. – Brian Roach Jan 04 '13 at 19:20

1 Answers1

0

This worked per @Brian's comment:

java -cp ".\endorsed_lib\*;.\genlib\*;.\lib\commons\*;.\lib\jdbc\*;.\lib\log4j\*;.\lib\spring\*;.\*" edu.harvard.i2b2.ncbo.extraction.NCBOOntologyExtractAll -ont 47178 -apikey {key} -outputFileName 47178_stagingFile.txt
JustBeingHelpful
  • 18,332
  • 38
  • 160
  • 245