I have the following .java file:
import java.io.*;
import org.apache.commons.cli.*;
public class Main
{
public static void main(String[] args)
{
...
}
}
I am compiling it with: javac -cp ./commons-cli-1.4.jar Main.java
But when I try to run it with: java -cp ./commons-cli-1.4.jar Main
I get the following error: Could not find or load main class Main
. I know I should give the full class name after the path to the jar file but I do not have any package. All I have on this machine about this project is one directory including .jar file and Main.java and already Main.class. So, I cannot understand what could be the problem...