Search code examples
javawindowscommand-linecommandfileutils

Run A Java Program That Calls On An External Jar


I'm trying to run a Java program that calls on the C:\Users\Brandon\Downloads\commons-io-2.4 folder. It compiled fine with this code javac -cp "C:\Users\Brandon\Downloads\commons-io-2.4\*" Login.java but when I tried to run it with this code java -cp C:\Users\Brandon\Downloads\commons-io-2.4\* Login it gave me thiserror: Could not find or load main class Login.class How do I fix this? P.S. The program calls on the FileUtils.


Solution

  • You need to add the current location as part of classpath.

    java -cp .;C:\Users\Brandon\Downloads\commons-io-2.4\* Login
    

    symbol .(dot) is the current path, separated by comma