hellzone :
How can I include current folder as classpath? I got a Utility and a Main class like;
/home/project/Main.class
/home/project/libs/com/fr/Utility.class
When I try to run Main class as(under /home/project/ dir);
java -cp "libs/*;" Main
I am getting below error.
Error: Could not find or load main class Main
EDIT:
Main class;
import com.fr.Utility;
public class Main{
....
}
Utility class;
package com.fr;
public class Utility{
....
}
When I run;
java -cp .:libs/* Main
I am getting below error;
Exception in thread "main" java.lang.NoClassDefFoundError: com/fr/Utility
Caused by: java.lang.ClassNotFoundException: com.fr.Utility
am9417 :
You should use colon as the path separator :
if you are on Linux, ;
if on Windows.
Also include the current path with a dot .
and remove the wildcard *
from the classpath:
java -cp .:libs/ Main
or java -cp .;libs/ Main
See this answer and also the "Understanding class path wildcards" section in this documentation.