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 <[email protected]> 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 >> >>
