简体   繁体   中英

Trying to build/run java program from cmd line with external library

I am trying to run a java program from the cmd line but I have an external library, as per below: 在此处输入图片说明

I have tried the advice from this previous question ( Java - Build and run eclipse project from command line ), like this:

java -cp <classpath> <main class> <args>

In my case (with response):

java -cp "ejml-v0.34-libs/*" MatrixServer
Error: Could not find or load main class MatrixServer.java

I may be confused as how to run my file and the path to it?

When I try and run the java file normally with javac then java, it has issues referencing the external 'ejml' library. I'm just looking for an easy way to run it form the cmd line!

java -cp "ejml-v0.34-libs/*;." MatrixServer

. to include your current directory(where compiled files are located ) along with ejml-v0.34-libs folder.

<classpath> - list of directories and/or JAR-files where needed classes reside separated by ";" for Windows or ":" for linux (default classpath is "." - the current directory);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM