Search code examples
javamallet

Couldn't open mallet logging.properties file


I try to run ParallelTopicModel class from mallet, i'm using NetBeans to compile it, but when i run the code i get this error statement:

Couldn't open cc.mallet.util.MalletLogger resources/logging.properties file. Perhaps the 'resources' directories weren't copied into the 'class' directory.

I haven't change any code anyway, still use the original from the class:

public static void main (String[] args) {
    try {
        InstanceList training = InstanceList.load (new File(args[0]));

        int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;

        ParallelTopicModel lda = new ParallelTopicModel (numTopics, 50.0, 0.01);
        lda.printLogLikelihood = true;
        lda.setTopicDisplay(50, 7);
        lda.addInstances(training);

        lda.setNumThreads(Integer.parseInt(args[2]));
        lda.estimate();
        logger.info("printing state");
        lda.printState(new File("state.gz"));
        logger.info("finished printing");

    } catch (Exception e) {
        e.printStackTrace();
    }
}

I am very new to mallet, so I don't know what's that mean, and how can I fix it? Any help would be appreciated.


Solution

  • Mallet is looking for a Java property java.util.logging.config.file. If it doesn't find it, it looks for the resources/logging.properties file, and if it doesn't find that it throws the error you saw.

    The default Mallet logging file is at https://github.com/mimno/Mallet/blob/master/src/cc/mallet/util/resources/logging.properties.

    You'll need to consult NetBeans documentation for how to set the Java property.