Homework #1 FAQ

1. When I run Jena, I get the following messages:
   log4j:WARN No appenders could be found for logger (com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler).
   log4j:WARN Please initialize the log4j system properly.
   log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info. 
How do I fix this?
Jena uses log4j to manage and record its error messages. To make sure it works properly with your system, you need to tell Java where to find the log4j properties file. To do this: Note, what I told you in class works for Jena 2.7, but not for the latest release, 2.12.
2. How do I read from a tab-delimited text file, so that multi-word album titles and artist names are kept together as a single string?
You have two choices, both use the java.util.Scanner class for simplicity.
Scanner input = new Scanner(myFile);
3. When I try to run my program at the command line, it cannot find the Jena classes. How do I fix this?
The Jena class are in JAR files, which can be found in Jena's lib folder. You need to tell the JVM the location of these files. You do this using the -cp option, e.g.:
java -cp C:/Users/heflin/Documents/Code/apache-jena-2.12.0/lib/*;. userid.AlbumsToRdf top20albums.txt
In Unix, Linux and Mac, you will need to change the separator character used for classpaths from ";" to ":":
java -cp C:/Users/heflin/Documents/Code/apache-jena-2.12.0/lib/*:. userid.AlbumsToRdf top20albums.txt
4. How do I use the SwPub.java file that you provided.
You must add the following at the top of the file:
package userid;
and put it in your userid directory. Be sure to include this file with your submission. Note, earlier today I said it was okay to leave the file out of your submission and I would have it available in the default package. That only works with very old versions of Java. If you already submitted it, do not fear, I will make the necessary correction for you (but only for this issue).