java - 无法执行.jar文件 "Could not find the main class"

标签 java

我有一个奇怪的问题。当我尝试运行任何 .jar 文件时,收到错误消息:

---------------------------
Java Virtual Machine Launcher
---------------------------
Could not find the main class: C:\Program Files (x86)\DirBuster\DirBuster.jar.  Program will exit.
---------------------------
OK   
---------------------------

我尝试了多个 .jar 文件,但所有文件都会出现此错误。我尝试过重新安装JAVA,通过cmd运行程序,但问题仍然存在。 任何人都将不胜感激。

谢谢。

最佳答案

确保您有一个 main 方法(必须声明为 public static void) - 如果您的类中有多个 main 方法,请在 list 文件中声明入口点。

关于java - 无法执行.jar文件 "Could not find the main class",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10971308/

相关文章:

java - 数组仅将项目放置在数组的第一个位置

java - Apache poi Excel : Creating a formula based on the integer index of the column

java - 使用过滤器在登录尝试失败后重定向

java - 如何在不关闭 OutputStream 对象的情况下强制刷新它?

java.net.SocketException : Connection reset by peer: socket write error When serving a file 异常

java - 使用 POI 写入现有 xls 文件

java - 链表中的节点可以有动态数组吗?

java - spring batch 在作业存储库和实际任务之间使用不同的事务管理器

java - 函数结果 AS 类字段值

java - h : component and a4j:components? 之间的差异