简体   繁体   中英

Running jar file in command prompt. Java can't find libraries in classpath

EDIT: OK, I think I was being silly. What I really wanted to do was a runnable JAR. I did and now it works.

So I'm trying to run a little program that interacts with some webpages. The program works fine when I launch it from Eclipse but when I export it to a jar file and try to run it from the command prompt I get this error message:

在此输入图像描述

What am I missing here?

I'm assuming in Eclipse you've added the appropriate libraries to your build path. When you run your program through eclipse, it automatically creates a java command including all your libraries in the classpath.

You need to do the same thing

java -cp /path/to/libs -jar muzictest.jar

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