'ol错误:无法找到或加载主类os x

时间:2023-01-18 10:19:14

I have a program with packages and dependent jars I'm trying to run. I've tried by executable jar but have fallen back to just using bash.

我有一个程序包含我正在尝试运行的包和依赖的jar。我已经尝试过可执行jar但已经退回到使用bash。

* Yes I have read the multitude of * articles on this *

*是的我已经阅读了关于此*的众多*文章

Most said examples refer to simple flat projects

大多数所述示例涉及简单的平面项目

project
 + libs/                     # all my external depends
 + src/main/java/com/blah    # files
 + target/classes            # where I create the class files.

Yes, this is a Jersey servlet. From the command line I run:

是的,这是泽西岛的servlet。从命令行我运行:

   export BIGGIE='./:./target/classes/com/blah/*:libs/activation-1.1.jar:libs/jackson-annotations-2.8.10.jar:libs/jackson-core-2.8.10.jar:libs/jackson-databind-2.8.10.jar:libs/jackson-module-jaxb-annotations-2.8.10.jar:libs/javax.annotation-api-1.2.jar:libs/javax.inject-2.5.0-b42.jar:libs/javax.ws.rs-api-2.1.jar:libs/jaxb-api-2.2.4.jar:libs/jersey-bundle-1.19.4.jar:libs/jersey-common-2.27.jar:libs/jersey-entity-filtering-2.27.jar:libs/jersey-media-json-jackson-2.27.jar:libs/jsr311-api-1.1.1.jar:libs/osgi-resource-locator-1.0.1.jar:libs/servlet-api-2.5.jar:libs/stax-api-1.0-2.jar'

    java -verbose -cp $BIGGIE com.blah.Main

    and receive the error Error: Could not find or load main class com.blah.Main.

And lots of library loaded messages NONE of which are my libs if that is significant.

还有很多库加载的消息,如果有重要的话,它们就是我的库。

I've tried using all variants of the Main class package name. I tried moving all the class files into the libs dir,etc.

我已经尝试使用Main类包名称的所有变体。我尝试将所有类文件移动到libs目录等。

This all runs fine when run from intellij, but I need a standalone version I can run from a Makefile. Don't ask why.

从intellij运行时,这一切都运行良好,但我需要一个可以从Makefile运行的独立版本。不要问为什么。

Mucho thanks.

1 个解决方案

#1


1  

The path to your folder stops at the folder containing "com". Change your BIGGIE declaration, the part that currently says ./target/classes/com/blah/* should just be ./target/classes/

文件夹的路径在包含“com”的文件夹中停止。更改您的BIGGIE声明,当前说的部分./target/classes/com/blah/*应该是./target/classes/

#1


1  

The path to your folder stops at the folder containing "com". Change your BIGGIE declaration, the part that currently says ./target/classes/com/blah/* should just be ./target/classes/

文件夹的路径在包含“com”的文件夹中停止。更改您的BIGGIE声明,当前说的部分./target/classes/com/blah/*应该是./target/classes/