0

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.

user2339071
  • 4,254
  • 1
  • 27
  • 46
user1419243
  • 1,655
  • 3
  • 19
  • 33
  • If it return `%CLASSPATH%`, it means that you have not set the classpath. Are you using any particular IDE ..? Like Eclipse or NetBeans.? – user2339071 Oct 07 '13 at 07:43
  • No, I am directly using the command line. However, isn't "java -cp" supposed to set the classpath? – user1419243 Oct 07 '13 at 08:09
  • Why is your string like `C:\mallet\class:C:\mallet\lib\mallet-deps.jar` ..? Why the two `C:`..? – user2339071 Oct 07 '13 at 08:16
  • Try this link: http://stackoverflow.com/questions/7485670/error-could-not-find-or-load-main-class – user2339071 Oct 07 '13 at 08:18
  • this was on the website of Mallet (as I referred in my question): `java -cp "/home/hough/mallet/class:/home/hough/mallet/lib/mallet-deps.jar"` As it was for linux, I tried to change it to be correct for my windows OS. Is that wrong? – user1419243 Oct 07 '13 at 08:18

1 Answers1

0

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!

user1419243
  • 1,655
  • 3
  • 19
  • 33