简体   繁体   English

为什么我的可执行文件 jar 找不到主 class?

[英]Why does my executable jar not find the main class?

Trying to export my java app from Eclipse into a runnable jar file.尝试将我的 java 应用程序从 Eclipse 导出到可运行的 jar 文件中。 (It's a console app) (这是一个控制台应用程序)

This is what the project directory looks like in Eclipse:这是 Eclipse 中项目目录的样子:

在此处输入图像描述


This is what the run configuration of the project looks like:这是项目的运行配置:

在此处输入图像描述


This is what the jar creation options look like:这是 jar 创建选项的样子:

在此处输入图像描述


And finally, this is the error I get:最后,这是我得到的错误:

在此处输入图像描述

I've literally tried everything and I'm so lost as to why it's not running.我实际上已经尝试了所有方法,但我很迷茫,为什么它没有运行。 The main class is selected properly, the run configuration seems right, I tried both runnable and regular, BOTH don't work.主class选择正确,运行配置似乎正确,我尝试了runnable和regular,两者都不起作用。

I tried cleaning, rebuilding, and even re-making the project and that didn't work.我尝试清理、重建,甚至重新制作项目,但都没有奏效。

I've researched this problem and everyone just suggests stuff like configurating the eclipse java path or making sure my app "isn't in a package" which doesn't make sense to me (aren't all java classes in a package)我已经研究了这个问题,每个人都只是建议配置eclipse Z93F725A07423FE1C889F44448B33D21F46Z PATH或IN BECENT333333。

Any help would be much appreciated!任何帮助将非常感激!

The way to run an executable jar from the command line is:从命令行运行可执行 jar 的方法是:

java -jar "AlphaScript_Interactive V1.0.0.jar"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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