I’m trying to use Mallet for the textual analysis of medieval English romances. Mallet is coded in Java and runs from the Command Line.
When I import a text file into Mallet with: bin\mallet import-dir --input sample-data\web\en\Chaucher.text --output tutorial.mallet --keep-sequence --remove-stopwords
I get a Java classpath error: Could not find or load main class Files\Mallet\Mallet-2.0.8\class;C:\Program Caused by: java.lang.ClassNotFoundException: Files\Mallet\Mallet-2/0/8\class;C:\Program
Suggested solutions found through Google failed. When I posted this question Stackoverflow automatically referred me to How do I resolve ClassNotFoundException?
Following this, I set the classpath by running Java -classpath c:\program files\mallet\mallet-2.0.8\sample-data\web\en. I still got the same error (Error: Could not find or load main class files\mallet\mallet-2.0.8\sample-data\web\en Caused by: java.lang.ClassNotFoundException: files\mallet\mallet-2.0.8\sample-data\web\en) - note, though, being unfamiar with Java I may have misunderstood this post.
I am now lost, unsure if my environment variables and paths are correctly set or if my Command Line Java code is incorrect. I believe I have correctly followed all the installation instructions, including setting environment and paths for Java, Ant and Mallet, as well advice in Stackoverflow posts.
I would, then, be most grateful for suggestions as to where I might go from here.
Background
I am running Windows 10 Professional on a Dell T7910 Workstation with 64 GB of memory.
I have 1) installed: Java, Ant and Mallet as instructed by various Mallet websites.* 2) have modified environment variables as follows:
Java_Home - C:\Program Files\Java\jdk-17.0.2 (This is in System Variables)
Mallet_Home - C:\Program Files\Mallet\Mallet-2.0.8 (This is in System Variables)
Ant_Home - c:\Program Files\Ant (I have this in User Variables rather than System Variables. Could this be a problem?)
My Paths are:
%ant_home%\bin
C:\Program Files\Java\jdk-17.0.2\Bin
%Mallet_Home%\
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\ProgramData\Oracle\Java\javapath
I have successfully installed Mallet, as when I run bin\mallet, I get the verifying response, Mallet 2.0 commands:
My Mallet directory structure is as follows. The program is installed in: c:\program files\mallet This directory has four sub directories.
cc
class
mallet
mallet-2.0.8 (Mallet-2.0.8 has the following eight(8) sub directories)
bin
class
dist
lib
sample-data (which includes: \web\en\Chaucer.txt)
src
stoplists
test
with Chaucer.txt being the text file I want to load into Mallet (could this be the problem? I have read that “import-dir is designed to take multiple directories as input.” (Trick to use file paths with spaces in Mallet (Terminal, OSx)?).
I am running my Java classpath and Mallet import code from: c:\program files\mallet\mallet-2.0.8.
My thanks in advance for anyone who can advise me how I should set my Java classpaths when using Mallet.
- I consulted the following webpages for installing and using Mallet:
https://mimno.github.io/Mallet/import
https://programminghistorian.org/en/lessons/topic-modeling-and-mallet
Postings I reviewed for answers to my path problem include:
Running MALLET on Windows; could not find or load main class cc.mallet.classify.tui.Text2Vectors
Using Mallet on Cygwin
Error: Could not load or find main class language
Mallet SimpleTagger Classpath
Trick to use file paths with spaces in Mallet (Terminal, OSx)?
How do I resolve ClassNotFoundException?