You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Cumulative Knowledge <kn...@gmail.com> on 2018/04/21 19:53:25 UTC

JENAROOT or CLASSPATH Issue

I'm getting Apache Jena set up and am having some issues. I think my issue
is with environment variable, but I'm not sure.

Here is what I've posted on Stack Overflow:

Based on this tutorial
<http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
gotten my workspace set up. I've removed the package identifier from my code
<https://stackoverflow.com/questions/36402759/error-could-not-find-or-load-main-class-classdemo>
.

Now I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/jena/rdf/model/ModelFactory at
Tutorial01.main(Tutorial01.java:34)
Caused by: java.lang.ClassNotFoundException:
org.apache.jena.rdf.model.ModelFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I think it's a JENAROOT Issue. I think I'm setting it and adding it
<https://stackoverflow.com/questions/28177971/tdbloader2-fails-with-classpath-error/28181902#28181902>
 to the path correctly. It's also mentioned here
<https://jena.apache.org/documentation/tools/>, but I haven't been able to
troubleshoot it yet.

Anybody can point me in the right direction?
Thanks,
Louis

Re: JENAROOT or CLASSPATH Issue

Posted by Andy Seaborne <an...@apache.org>.

On 22/04/18 19:51, Cumulative Knowledge wrote:
> I've been trying a few different things that produce different results.
> Thought this information might be helpful.
> 
> $ java Tutorial01
> Error: Could not find or load main class Tutorial01
> 
> $ java -cp "$JENA_HOME/lib/*:" Tutorial01
> log4j:WARN No appenders could be found for logger (Jena).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.

see various questions stackoverflow.  They are just warnings.

> 
> $ sudo java Tutorial01
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/jena/rdf/model/ModelFactory
> at Tutorial01.main(Tutorial01.java:34)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.jena.rdf.model.ModelFactory
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 1 more
> 
> 
> $ sudo java -cp "$JENA_HOME/lib/*:" Tutorial01

Incorrect format: Escape the "*", no :

> log4j:WARN No appenders could be found for logger (Jena).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> 
> On Sun, Apr 22, 2018 at 1:42 AM, Andy Seaborne <an...@apache.org> wrote:
> 
>> Louis,
>>
>> The exception means that the classpth does not contain the jena-core jar.
>> Put all the jars from the distribution lib directory in the classpath.
>> Nowadays in java you can put '...\lib\*' on the classpath and it will
>> include all the jars in that directory.
>>
>> See the bat scripts in the download or
>> https://github.com/apache/jena/tree/master/apache-jena/bat
>>
>> then print out the classpath to make sure it is right.
>>
>>      Andy
>>
>> On 21/04/18 20:53, Cumulative Knowledge wrote:
>>
>>> I'm getting Apache Jena set up and am having some issues. I think my issue
>>> is with environment variable, but I'm not sure.
>>>
>>> Here is what I've posted on Stack Overflow:
>>>
>>> Based on this tutorial
>>> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
>>> gotten my workspace set up. I've removed the package identifier from my
>>> code
>>>
>>
>> The way to call main is to use it's full name, package included:
>>
>> java -cp ...  <fullname>
>>
>> java -cp ...  a.b.C
>>
>> where C has the static main method
>>
>> <https://stackoverflow.com/questions/36402759/error-could-
>>> not-find-or-load-main-class-classdemo>
>>> .
>>>
>>> Now I get this error:
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/jena/rdf/model/ModelFactory at
>>> Tutorial01.main(Tutorial01.java:34)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.jena.rdf.model.ModelFactory
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>
>>> I think it's a JENAROOT Issue. I think I'm setting it and adding it
>>> <https://stackoverflow.com/questions/28177971/tdbloader2-fai
>>> ls-with-classpath-error/28181902#28181902>
>>>    to the path correctly. It's also mentioned here
>>> <https://jena.apache.org/documentation/tools/>, but I haven't been able
>>> to
>>> troubleshoot it yet.
>>>
>>> Anybody can point me in the right direction?
>>> Thanks,
>>> Louis
>>>
>>>
> 

Re: JENAROOT or CLASSPATH Issue

Posted by Cumulative Knowledge <kn...@gmail.com>.
I've been trying a few different things that produce different results.
Thought this information might be helpful.

$ java Tutorial01
Error: Could not find or load main class Tutorial01

$ java -cp "$JENA_HOME/lib/*:" Tutorial01
log4j:WARN No appenders could be found for logger (Jena).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.

$ sudo java Tutorial01
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/jena/rdf/model/ModelFactory
at Tutorial01.main(Tutorial01.java:34)
Caused by: java.lang.ClassNotFoundException:
org.apache.jena.rdf.model.ModelFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more


$ sudo java -cp "$JENA_HOME/lib/*:" Tutorial01
log4j:WARN No appenders could be found for logger (Jena).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.

On Sun, Apr 22, 2018 at 1:42 AM, Andy Seaborne <an...@apache.org> wrote:

> Louis,
>
> The exception means that the classpth does not contain the jena-core jar.
> Put all the jars from the distribution lib directory in the classpath.
> Nowadays in java you can put '...\lib\*' on the classpath and it will
> include all the jars in that directory.
>
> See the bat scripts in the download or
> https://github.com/apache/jena/tree/master/apache-jena/bat
>
> then print out the classpath to make sure it is right.
>
>     Andy
>
> On 21/04/18 20:53, Cumulative Knowledge wrote:
>
>> I'm getting Apache Jena set up and am having some issues. I think my issue
>> is with environment variable, but I'm not sure.
>>
>> Here is what I've posted on Stack Overflow:
>>
>> Based on this tutorial
>> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
>> gotten my workspace set up. I've removed the package identifier from my
>> code
>>
>
> The way to call main is to use it's full name, package included:
>
> java -cp ...  <fullname>
>
> java -cp ...  a.b.C
>
> where C has the static main method
>
> <https://stackoverflow.com/questions/36402759/error-could-
>> not-find-or-load-main-class-classdemo>
>> .
>>
>> Now I get this error:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/jena/rdf/model/ModelFactory at
>> Tutorial01.main(Tutorial01.java:34)
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.jena.rdf.model.ModelFactory
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>
>> I think it's a JENAROOT Issue. I think I'm setting it and adding it
>> <https://stackoverflow.com/questions/28177971/tdbloader2-fai
>> ls-with-classpath-error/28181902#28181902>
>>   to the path correctly. It's also mentioned here
>> <https://jena.apache.org/documentation/tools/>, but I haven't been able
>> to
>> troubleshoot it yet.
>>
>> Anybody can point me in the right direction?
>> Thanks,
>> Louis
>>
>>

Re: JENAROOT or CLASSPATH Issue

Posted by Cumulative Knowledge <kn...@gmail.com>.
I think I must be getting closer, but I'm still getting the same error. Now
that I'm escaping the *, the path seems correct.

Here are my current environmental variable settings:

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

$JENA_HOME
/Users/username/Documents/jena/apachejena370

echo $JENAROOT
/Users/username/Documents/jena/apachejena370

$ echo $CLASSPATH
/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin:/Users/
username/Documents/jena/apachejena370/lib/*

When I run the code:

$ sudo java Tutorial01
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/jena/rdf/model/ModelFactory
at Tutorial01.main(Tutorial01.java:34)
Caused by: java.lang.ClassNotFoundException: org.apache.jena.rdf.model.
ModelFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more


I've also somehow broken something because javac is no longer working:
$ sudo javac Tutorial01.java

Tutorial01.java:21: error: package org.apache.jena.rdf.model does not exist
import org.apache.jena.rdf.model.*;
^
Tutorial01.java:22: error: package org.apache.jena.vocabulary does not exist
import org.apache.jena.vocabulary.*;
^
Tutorial01.java:34: error: cannot find symbol
        Model model = ModelFactory.createDefaultModel();
        ^
  symbol:   class Model
  location: class Tutorial01
Tutorial01.java:34: error: cannot find symbol
        Model model = ModelFactory.createDefaultModel();
                      ^
  symbol:   variable ModelFactory
  location: class Tutorial01
Tutorial01.java:37: error: cannot find symbol
       Resource johnSmith = model.createResource(personURI);
       ^
  symbol:   class Resource
  location: class Tutorial01
Tutorial01.java:40: error: cannot find symbol
      johnSmith.addProperty(VCARD.FN, fullName);
                            ^
  symbol:   variable VCARD
  location: class Tutorial01
6 errors

On Sun, Apr 22, 2018 at 12:49 PM, Andy Seaborne <an...@apache.org> wrote:

>
>
> On 22/04/18 19:28, Cumulative Knowledge wrote:
>
>> Hi Andy,
>>
>> Thanks for the help. I'm still getting the same error. Right now I
>> have JENAROOT and JENA_HOME set to the same path.
>>
>> I added classpath like so:
>> $ export CLASSPATH=$CLASSPATH:$JENA_HOME/lib/*
>>
>>
> You need to escape the * to stop it be shell expansion. The * needs to be
> passed to java.
>
> export CLASSPATH=$CLASSPATH:$JENA_HOME/lib/\*
>
> Here is what my current classpath:
>> $ echo $CLASSPATH
>>
>
> This does not agree with the line above - no ":" after whatever $CLASSPATH
> was before the export.
>
> /Users/username/Documents/jena/apachejena370/lib/collection-0.7.jar
>> /Users/username/Documents/jena/apachejena370/lib/commons-cli-1.4.jar
>> /Users/username/Documents/jena/apachejena370/lib/commons-codec-1.11.jar
>> /Users/username/Documents/jena/apachejena370/lib/commons-csv-1.5.jar
>> /Users/username/Documents/jena/apachejena370/lib/commons-io-2.6.jar
>> /Users/username/Documents/jena/apachejena370/lib/commons-lang3-3.4.jar
>> /Users/username/Documents/jena/apachejena370/lib/httpclient-4.5.3.jar
>> /Users/username/Documents/jena/apachejena370/lib/httpclient-
>> cache-4.5.3.jar
>> /Users/username/Documents/jena/apachejena370/lib/httpcore-4.4.6.jar
>> /Users/username/Documents/jena/apachejena370/lib/jackson-
>> annotations-2.9.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jackson-core-2.9.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jackson-
>> databind-2.9.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jcl-over-
>> slf4j-1.7.25.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-arq-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-base-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-cmds-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-core-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-base-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-
>> index-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-
>> trans-data-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-
>> transaction-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-iri-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-rdfcon
>> nection-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-shaded
>> -guava-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-tdb-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jena-tdb2-3.7.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/jsonld-java-0.11.1.jar
>> /Users/username/Documents/jena/apachejena370/lib/libthrift-0.10.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/log4j-1.2.17.jar
>> /Users/username/Documents/jena/apachejena370/lib/slf4j-api-1.7.25.jar
>> /Users/username/Documents/jena/apachejena370/lib/slf4j-log4j12-1.7.25.jar
>> /Users/username/Documents/jena/apachejena370/lib/xercesImpl-2.11.0.jar
>> /Users/username/Documents/jena/apachejena370/lib/xml-apis-1.4.01.jar
>>
>>
>> Any thoughts?
>>
>> Thanks,
>> Louis
>>
>> On Sun, Apr 22, 2018 at 1:42 AM, Andy Seaborne <an...@apache.org> wrote:
>>
>> Louis,
>>>
>>> The exception means that the classpth does not contain the jena-core jar.
>>> Put all the jars from the distribution lib directory in the classpath.
>>> Nowadays in java you can put '...\lib\*' on the classpath and it will
>>> include all the jars in that directory.
>>>
>>> See the bat scripts in the download or
>>> https://github.com/apache/jena/tree/master/apache-jena/bat
>>>
>>> then print out the classpath to make sure it is right.
>>>
>>>      Andy
>>>
>>> On 21/04/18 20:53, Cumulative Knowledge wrote:
>>>
>>> I'm getting Apache Jena set up and am having some issues. I think my
>>>> issue
>>>> is with environment variable, but I'm not sure.
>>>>
>>>> Here is what I've posted on Stack Overflow:
>>>>
>>>> Based on this tutorial
>>>> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
>>>> gotten my workspace set up. I've removed the package identifier from my
>>>> code
>>>>
>>>>
>>> The way to call main is to use it's full name, package included:
>>>
>>> java -cp ...  <fullname>
>>>
>>> java -cp ...  a.b.C
>>>
>>> where C has the static main method
>>>
>>> <https://stackoverflow.com/questions/36402759/error-could-
>>>
>>>> not-find-or-load-main-class-classdemo>
>>>> .
>>>>
>>>> Now I get this error:
>>>>
>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>> org/apache/jena/rdf/model/ModelFactory at
>>>> Tutorial01.main(Tutorial01.java:34)
>>>> Caused by: java.lang.ClassNotFoundException:
>>>> org.apache.jena.rdf.model.ModelFactory
>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>>
>>>> I think it's a JENAROOT Issue. I think I'm setting it and adding it
>>>> <https://stackoverflow.com/questions/28177971/tdbloader2-fai
>>>> ls-with-classpath-error/28181902#28181902>
>>>>    to the path correctly. It's also mentioned here
>>>> <https://jena.apache.org/documentation/tools/>, but I haven't been able
>>>> to
>>>> troubleshoot it yet.
>>>>
>>>> Anybody can point me in the right direction?
>>>> Thanks,
>>>> Louis
>>>>
>>>>
>>>>
>>

Re: JENAROOT or CLASSPATH Issue

Posted by Andy Seaborne <an...@apache.org>.

On 22/04/18 19:28, Cumulative Knowledge wrote:
> Hi Andy,
> 
> Thanks for the help. I'm still getting the same error. Right now I
> have JENAROOT and JENA_HOME set to the same path.
> 
> I added classpath like so:
> $ export CLASSPATH=$CLASSPATH:$JENA_HOME/lib/*
> 

You need to escape the * to stop it be shell expansion. The * needs to 
be passed to java.

export CLASSPATH=$CLASSPATH:$JENA_HOME/lib/\*

> Here is what my current classpath:
> $ echo $CLASSPATH

This does not agree with the line above - no ":" after whatever 
$CLASSPATH was before the export.

> /Users/username/Documents/jena/apachejena370/lib/collection-0.7.jar
> /Users/username/Documents/jena/apachejena370/lib/commons-cli-1.4.jar
> /Users/username/Documents/jena/apachejena370/lib/commons-codec-1.11.jar
> /Users/username/Documents/jena/apachejena370/lib/commons-csv-1.5.jar
> /Users/username/Documents/jena/apachejena370/lib/commons-io-2.6.jar
> /Users/username/Documents/jena/apachejena370/lib/commons-lang3-3.4.jar
> /Users/username/Documents/jena/apachejena370/lib/httpclient-4.5.3.jar
> /Users/username/Documents/jena/apachejena370/lib/httpclient-cache-4.5.3.jar
> /Users/username/Documents/jena/apachejena370/lib/httpcore-4.4.6.jar
> /Users/username/Documents/jena/apachejena370/lib/jackson-annotations-2.9.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jackson-core-2.9.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jackson-databind-2.9.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jcl-over-slf4j-1.7.25.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-arq-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-base-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-cmds-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-core-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-base-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-index-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-trans-data-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-dboe-transaction-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-iri-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-rdfconnection-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-shaded-guava-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-tdb-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jena-tdb2-3.7.0.jar
> /Users/username/Documents/jena/apachejena370/lib/jsonld-java-0.11.1.jar
> /Users/username/Documents/jena/apachejena370/lib/libthrift-0.10.0.jar
> /Users/username/Documents/jena/apachejena370/lib/log4j-1.2.17.jar
> /Users/username/Documents/jena/apachejena370/lib/slf4j-api-1.7.25.jar
> /Users/username/Documents/jena/apachejena370/lib/slf4j-log4j12-1.7.25.jar
> /Users/username/Documents/jena/apachejena370/lib/xercesImpl-2.11.0.jar
> /Users/username/Documents/jena/apachejena370/lib/xml-apis-1.4.01.jar
> 
> 
> Any thoughts?
> 
> Thanks,
> Louis
> 
> On Sun, Apr 22, 2018 at 1:42 AM, Andy Seaborne <an...@apache.org> wrote:
> 
>> Louis,
>>
>> The exception means that the classpth does not contain the jena-core jar.
>> Put all the jars from the distribution lib directory in the classpath.
>> Nowadays in java you can put '...\lib\*' on the classpath and it will
>> include all the jars in that directory.
>>
>> See the bat scripts in the download or
>> https://github.com/apache/jena/tree/master/apache-jena/bat
>>
>> then print out the classpath to make sure it is right.
>>
>>      Andy
>>
>> On 21/04/18 20:53, Cumulative Knowledge wrote:
>>
>>> I'm getting Apache Jena set up and am having some issues. I think my issue
>>> is with environment variable, but I'm not sure.
>>>
>>> Here is what I've posted on Stack Overflow:
>>>
>>> Based on this tutorial
>>> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
>>> gotten my workspace set up. I've removed the package identifier from my
>>> code
>>>
>>
>> The way to call main is to use it's full name, package included:
>>
>> java -cp ...  <fullname>
>>
>> java -cp ...  a.b.C
>>
>> where C has the static main method
>>
>> <https://stackoverflow.com/questions/36402759/error-could-
>>> not-find-or-load-main-class-classdemo>
>>> .
>>>
>>> Now I get this error:
>>>
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/jena/rdf/model/ModelFactory at
>>> Tutorial01.main(Tutorial01.java:34)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.apache.jena.rdf.model.ModelFactory
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>
>>> I think it's a JENAROOT Issue. I think I'm setting it and adding it
>>> <https://stackoverflow.com/questions/28177971/tdbloader2-fai
>>> ls-with-classpath-error/28181902#28181902>
>>>    to the path correctly. It's also mentioned here
>>> <https://jena.apache.org/documentation/tools/>, but I haven't been able
>>> to
>>> troubleshoot it yet.
>>>
>>> Anybody can point me in the right direction?
>>> Thanks,
>>> Louis
>>>
>>>
> 

Re: JENAROOT or CLASSPATH Issue

Posted by Cumulative Knowledge <kn...@gmail.com>.
Hi Andy,

Thanks for the help. I'm still getting the same error. Right now I
have JENAROOT and JENA_HOME set to the same path.

I added classpath like so:
$ export CLASSPATH=$CLASSPATH:$JENA_HOME/lib/*

Here is what my current classpath:
$ echo $CLASSPATH
/Users/username/Documents/jena/apachejena370/lib/collection-0.7.jar
/Users/username/Documents/jena/apachejena370/lib/commons-cli-1.4.jar
/Users/username/Documents/jena/apachejena370/lib/commons-codec-1.11.jar
/Users/username/Documents/jena/apachejena370/lib/commons-csv-1.5.jar
/Users/username/Documents/jena/apachejena370/lib/commons-io-2.6.jar
/Users/username/Documents/jena/apachejena370/lib/commons-lang3-3.4.jar
/Users/username/Documents/jena/apachejena370/lib/httpclient-4.5.3.jar
/Users/username/Documents/jena/apachejena370/lib/httpclient-cache-4.5.3.jar
/Users/username/Documents/jena/apachejena370/lib/httpcore-4.4.6.jar
/Users/username/Documents/jena/apachejena370/lib/jackson-annotations-2.9.0.jar
/Users/username/Documents/jena/apachejena370/lib/jackson-core-2.9.0.jar
/Users/username/Documents/jena/apachejena370/lib/jackson-databind-2.9.0.jar
/Users/username/Documents/jena/apachejena370/lib/jcl-over-slf4j-1.7.25.jar
/Users/username/Documents/jena/apachejena370/lib/jena-arq-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-base-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-cmds-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-core-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-dboe-base-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-dboe-index-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-dboe-trans-data-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-dboe-transaction-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-iri-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-rdfconnection-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-shaded-guava-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-tdb-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jena-tdb2-3.7.0.jar
/Users/username/Documents/jena/apachejena370/lib/jsonld-java-0.11.1.jar
/Users/username/Documents/jena/apachejena370/lib/libthrift-0.10.0.jar
/Users/username/Documents/jena/apachejena370/lib/log4j-1.2.17.jar
/Users/username/Documents/jena/apachejena370/lib/slf4j-api-1.7.25.jar
/Users/username/Documents/jena/apachejena370/lib/slf4j-log4j12-1.7.25.jar
/Users/username/Documents/jena/apachejena370/lib/xercesImpl-2.11.0.jar
/Users/username/Documents/jena/apachejena370/lib/xml-apis-1.4.01.jar


Any thoughts?

Thanks,
Louis

On Sun, Apr 22, 2018 at 1:42 AM, Andy Seaborne <an...@apache.org> wrote:

> Louis,
>
> The exception means that the classpth does not contain the jena-core jar.
> Put all the jars from the distribution lib directory in the classpath.
> Nowadays in java you can put '...\lib\*' on the classpath and it will
> include all the jars in that directory.
>
> See the bat scripts in the download or
> https://github.com/apache/jena/tree/master/apache-jena/bat
>
> then print out the classpath to make sure it is right.
>
>     Andy
>
> On 21/04/18 20:53, Cumulative Knowledge wrote:
>
>> I'm getting Apache Jena set up and am having some issues. I think my issue
>> is with environment variable, but I'm not sure.
>>
>> Here is what I've posted on Stack Overflow:
>>
>> Based on this tutorial
>> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
>> gotten my workspace set up. I've removed the package identifier from my
>> code
>>
>
> The way to call main is to use it's full name, package included:
>
> java -cp ...  <fullname>
>
> java -cp ...  a.b.C
>
> where C has the static main method
>
> <https://stackoverflow.com/questions/36402759/error-could-
>> not-find-or-load-main-class-classdemo>
>> .
>>
>> Now I get this error:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/jena/rdf/model/ModelFactory at
>> Tutorial01.main(Tutorial01.java:34)
>> Caused by: java.lang.ClassNotFoundException:
>> org.apache.jena.rdf.model.ModelFactory
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>
>> I think it's a JENAROOT Issue. I think I'm setting it and adding it
>> <https://stackoverflow.com/questions/28177971/tdbloader2-fai
>> ls-with-classpath-error/28181902#28181902>
>>   to the path correctly. It's also mentioned here
>> <https://jena.apache.org/documentation/tools/>, but I haven't been able
>> to
>> troubleshoot it yet.
>>
>> Anybody can point me in the right direction?
>> Thanks,
>> Louis
>>
>>

Re: JENAROOT or CLASSPATH Issue

Posted by Andy Seaborne <an...@apache.org>.
Louis,

The exception means that the classpth does not contain the jena-core 
jar.  Put all the jars from the distribution lib directory in the 
classpath. Nowadays in java you can put '...\lib\*' on the classpath and 
it will include all the jars in that directory.

See the bat scripts in the download or
https://github.com/apache/jena/tree/master/apache-jena/bat

then print out the classpath to make sure it is right.

     Andy

On 21/04/18 20:53, Cumulative Knowledge wrote:
> I'm getting Apache Jena set up and am having some issues. I think my issue
> is with environment variable, but I'm not sure.
> 
> Here is what I've posted on Stack Overflow:
> 
> Based on this tutorial
> <http://staff.um.edu.mt/cabe2/lectures/webscience/docs/jena.pdf> I've
> gotten my workspace set up. I've removed the package identifier from my code

The way to call main is to use it's full name, package included:

java -cp ...  <fullname>

java -cp ...  a.b.C

where C has the static main method

> <https://stackoverflow.com/questions/36402759/error-could-not-find-or-load-main-class-classdemo>
> .
> 
> Now I get this error:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/jena/rdf/model/ModelFactory at
> Tutorial01.main(Tutorial01.java:34)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.jena.rdf.model.ModelFactory
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 
> I think it's a JENAROOT Issue. I think I'm setting it and adding it
> <https://stackoverflow.com/questions/28177971/tdbloader2-fails-with-classpath-error/28181902#28181902>
>   to the path correctly. It's also mentioned here
> <https://jena.apache.org/documentation/tools/>, but I haven't been able to
> troubleshoot it yet.
> 
> Anybody can point me in the right direction?
> Thanks,
> Louis
>