Mallet SimpleTagger Classpath

2019-09-02 02:41发布

问题:

I am going to use Mallet SimpleTagger for sequence tagging. However, I have problem with setting the classpath. As I have seen here: classpath

I must be able to use java -cp to set the classpath. I followed the instructions here (I am sure that I have installed Ant and Mallet correctly). However, I receive this message:

Error: could not find or load main class cc.mallet.fst.SimpleTagger

Here is the real code that I use:

C:\mallet> java -cp "C:\mallet\class:C:\mallet\lib\mallet-deps.jar" cc.mallet.fst.SimpleTagger --model-file G:\test1-model G:\test2-feats.txt

Meanwhile, when I run this command: echo %CLASSPATH%, it returns %CLASSPATH%.

I would be thankful if anybody can help me.

回答1:

Fortunately, thanks to comments and suggested link of @user2339071, I could solve the problem:

If you are using Windows OS, you must replace ":" with ";". So, this code worked for me:

C:\mallet> java -cp "C:\mallet\class;C:\mallet\lib\mallet-deps.jar" cc.mallet.fst.SimpleTagger --model-file G:\test1-model G:\test2-feats.txt

Actually, what is done with this code is that two different paths are determined as the classpath, one is the folder which includes .class files of mallet (C:\mallet\class) and the other one includes all required jar files (C:\mallet\lib\mallet-deps.jar) and you need to separate them with ";".

That's all!