问题
When I run the following command:
bin/tdbloader2 --loc=/store/data/here /seed/data/serverfault-dump.nt
And the response I get is:
10:52:31 -- TDB Bulk Loader Start
10:52:31 Data phase
Error: Could not find or load main class com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder
Which is most likely caused by a problem with my environment variables, somewhere, of something. The problem is, I don't often work with Java and so I don't know enough to know how to figure out what that class cannot be found.
How do make tdbloader2 find the appropriate class?
回答1:
At a minimum you need to set the TDBROOT
environment variable to the directory containing your TDB download. This will be the directory above bin
as some of the scripts use ${TDBROOT}/bin/foo
to launch other scripts
The script attempts to automatically construct a valid class path by calling the tdb_path
script which calls either make_classpath_mvn
or make_classpath
depending on your environment. If you run the tdb_path
script directly you can see if it generates a sane looking class path or not (or add what it does generate to your question if the output doesn't provide anything helpful).
回答2:
I had forgotten to set the JENAROOT path variable.
https://jena.apache.org/documentation/tools/
An environment variable JENAROOT is used by all the command line tools to configure the class path automatically for you. You can set this up as follows:
On Linux / Mac
export JENAROOT=the directory you downloaded Jena to export PATH=$PATH:$JENAROOT/bin On Windows
SET JENAROOT=the directory you downloaded Jena to SET PATH=%PATH%;%JENAROOT%\bat
来源:https://stackoverflow.com/questions/28177971/tdbloader2-fails-with-classpath-error