我的 gradle 构建文件是plugins { // Apply the java plugin to add support for Java id 'java' // Apply the application plugin to add support for building a CLI application id 'application'}apply plugin: 'java'jar { from configurations.runtime manifest { attributes( 'Created-By':'Gmack', 'Main-Class':'myapprunner.App', 'Class-Path':'mydaos-1.0.jar' ) }}allprojects{ repositories { jcenter() }}subprojects { version = '1.0' apply plugin: 'java'}dependencies { // This dependency is used by the application. implementation 'com.google.guava:guava:27.1-jre' // Use JUnit test framework testImplementation 'junit:junit:4.12' // Compile Project for dependency compile project(':mydaos')}application { // Define the main class for the application mainClassName = 'myapprunner.App'}当我使用运行应用程序时java -jar myapprunner.jar我得到一个ClassNotFoundExceptionCaused by: java.lang.ClassNotFoundException: com.mydaos.Library at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 1 more我可以确认罐子已经装好。不知道为什么这没有解决问题。任何帮助,将不胜感激。
添加回答
举报
0/150
提交
取消