[英]spring-boot-maven-plugin created jar run by using classpath
used spring-boot-maven-plugin to build my jar, i'm to run it via 用spring-boot-maven-plugin构建我的jar,我要通过它运行
java -jar myExample-1.0-SNAPSHOT.jar
but it throw error 但它抛出错误
Error: Could not find or load main class com.manish.myexample.Example
错误:找不到或加载主类com.manish.myexample.Example
while running via 通过运行时
java -cp myExample-1.0-SNAPSHOT.jar com.manish.myexample.Example
is because of spring-boot-maven-plugin ? 是因为spring-boot-maven-plugin吗? and even tried
甚至尝试过
java -cp libs/myExample-1.0-SNAPSHOT.jar: BOOT-INF.classes.com.manish.myexample.Example
You must ensure that you add the location of your .class file to your classpath. 您必须确保将.class文件的位置添加到类路径中。 That is usually first mistake.
通常这是第一个错误。
...and some general reasons why Java cannot find the class: ...以及Java无法找到该类的一些一般原因:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.