Importing has nothing to do with loading classes or setting CLASSPATH.

Try this:

java -cp .;../lib/* Generator

Using the dot '.' as the first entry in the CLASSPATH assumes that the Generator.class file exists in the directory from which you're running java, and /lib is one level up from that directory. Adjust as needed if both of these are not correct.

Answer from duffymo on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › tools › unix › classpath.html
2 Setting the Class Path
April 21, 2026 - For example, suppose you want the ... that it contains /java/MyClasses. To run that application, you could use the following java command: java -classpath /java/MyClasses utility.myapp.Cool...
🌐
Blogger
javarevisited.blogspot.com › 2011 › 01 › how-classpath-work-in-java.html
How to Set Classpath for Java on Windows and Linux? Steps and Example
By using the export command, you can set the classpath for Java in Unix, Linux, Solaris, IBM AIX, or any other UNIX operating system. I hope this example for setting classpath in Java will enable to set classpath by yourself let me know if you face any problem while setting up classpath in Java · You can override classpath in Java, defined by environment variable CLASSPATH by providing option "-cp" or "-classpath" while running Java program ...
Discussions

jar - classpath - running a java program from the command line - Stack Overflow
My code compiled fine with the following command: javac -cp "../lib/*" AvroReader.java (lib is where i put my jar files) At run time I get a ClassNotFoundException on the following line: More on stackoverflow.com
🌐 stackoverflow.com
postgresql - Running a java program in linux terminal with -class path - Stack Overflow
The program compiled fine with the javac command, but I'm having a hard time running it with the postgresql classpath. More on stackoverflow.com
🌐 stackoverflow.com
December 29, 2010
java - adding classpath in linux - Stack Overflow
is the above statement for setting ... in linux is correct or not ... Save this answer. ... Show activity on this post. I don't like setting CLASSPATH. CLASSPATH is a global variable and as such it is evil: If you modify it in one script, suddenly some java programs will stop working. If you put there the libraries for all the things which you run, and it gets ... More on stackoverflow.com
🌐 stackoverflow.com
How to set Java classpath in Linux? - Stack Overflow
Are you loged in as root? On linux you have to run export CLASSPATH = %path%;LOG4J_HOME/og4j-1.2.16.jar If you want it permanent then you can add above lines in ~/.bashrc file. ... I would not do it in the .bashrc because it will fight with other projects/programs. More on stackoverflow.com
🌐 stackoverflow.com
🌐
HowToDoInJava
howtodoinjava.com › home › java examples › java – set classpath from command line
Java - Set Classpath from Command Line
January 25, 2022 - In Windows, the path separator is semicolon ( ; ) and the path separator in Linux is colon ( : ). ... Use -classpath or -cp option to provide the classpath locations while starting the Java application or tool.
🌐
Alvin Alexander
alvinalexander.com › blog › post › linux-unix › dynamically-build-java-classpath-in-bourne-shell-script
How to build a dynamic Java classpath in a shell script | alvinalexander.com
#!/bin/sh export JAVA_HOME=/usr/local/java PATH=/usr/local/java/bin:${PATH} cd /home/ala/DevDaily/Musubi #---------------------------------# # dynamically build the classpath # #---------------------------------# THE_CLASSPATH= for i in `ls ./lib/*.jar` do THE_CLASSPATH=${THE_CLASSPATH}:${i} done #---------------------------# # run the anti-spam program # #---------------------------# java -cp ".:${THE_CLASSPATH}" \ EmailAgentController \ lib/mail.properties \ lib/userMail.properties \ message.uid.cache \ | tee -a SPAM.mbox · I guess the Linux tee command and the line continuation stuff is good too, if you've never seen that.
🌐
Mcmaster
cas.mcmaster.ca › ~lis3 › javatutorial › Classpath.htm
java tutorial, CLASSPATH, -classpath, -d
You can set a value for Unix environment variable CLASSPATH. After CLASSPATH is set, java or javac will try to look for the necessary class files into the directories of $CLASSPATH. ... Now you can go to ~/jjava/class directory to delete all .class files. We will re-compile and run the Java ...
Find elsewhere
🌐
Wikipedia
en.wikipedia.org › wiki › Classpath_(Java)
Classpath - Wikipedia
January 26, 2025 - This means that when our working ... (on Linux, /home/user/myprogram/), we would not need to specify the classpath explicitly. When overriding however, it is advised to include the current folder "." into the classpath in the case when loading classes from current folder is desired. The same applies not only to java launcher but also to javac, the java compiler. If a program uses a supporting ...
🌐
Michigan State University
web.pa.msu.edu › reference › jdk-1.2.2-docs › tooldocs › solaris › classpath-linux.html
Setting the class path
To run that app, you could use the following JVM command: % java -classpath /java/MyClasses utility.myapp.Cool
🌐
Chilkat
chilkatsoft.com › java-classpath-Linux.asp
Java JAR Archives and classpath on Linux
echo $CLASSPATHAnother way of viewing the classpath is to run this Java code: String classpath = System.getProperty("java.class.path"); System.out.println(classpath); Modify the CLASSPATH environment variable to also include the directory containing the JAR archive.
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › environment › paths.html
PATH and CLASSPATH (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
To set the path permanently, set ... named by the environment variable, ENV. To set the path: ... The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes....
🌐
How to do in Java
howtodoinjava.com › home › java basics › java classpath
How to set CLASSPATH in Java - HowToDoInJava
February 23, 2023 - However, the second statement “$ java –classpath C:\dependency\framework.jar MyApp” fails with error unable to find MyApp class and requires updating the classpath including the location of MyApp.class which is the current directory in this case. Reply · Thanks for the feedback. Updated the article. It requires to run the javac and java command from the same directory where the java file is placed. Reply · How to set the classpath through our java program dynamically? Reply · //Linux/Unix $ export CLASSPATH=/dependency/framework.jar:/location/otherFramework.jar $ export C:\dependency\framework.jar:C:\location\*.jar
🌐
Blogger
javarevisited.blogspot.com › 2011 › 01 › how-classpath-work-in-java.html
Javarevisited: How to Set Classpath for Java on Windows and Linux? Steps and Example
By using the export command, you can set the classpath for Java in Unix, Linux, Solaris, IBM AIX, or any other UNIX operating system. I hope this example for setting classpath in Java will enable to set classpath by yourself let me know if you face any problem while setting up classpath in Java · You can override classpath in Java, defined by environment variable CLASSPATH by providing option "-cp" or "-classpath" while running Java program ...
🌐
Baeldung
baeldung.com › home › java › core java › java classpath syntax in linux vs. windows
Java Classpath Syntax in Linux vs. Windows | Baeldung
January 8, 2024 - We can define the elements in the classpath either through the -cp option of the java/javac commands or through the CLASSPATH environment variable. No matter which approach we take to set the classpath, we need to follow the classpath syntax.
🌐
GeeksforGeeks
geeksforgeeks.org › java › run-java-class-file-different-directory
How to run java class file which is in different directory? - GeeksforGeeks
May 7, 2019 - cp_tutorial/proj2/classes>java -cp ../../proj1/classes; MainClass In main class Test() method of class A Now, you have successfully run your program. Don't forget to include ';' after provided classpath. Replace ';' with ':' for OS/Linux.