首页 > 解决方案 > 运行 jar 文件时出现 ArrayIndexOutofBoundsException

问题描述

我有一个要运行的 jar 文件。我最初是在批处理脚本中运行它,但现在我想将它作为 shell 脚本运行。(我没有写这段代码,所以我无权访问主类)

我的 jar 文件名为 MyFile.jar,我正在使用

java -jar MyFile.jar

但是,我收到一条错误消息:

ArrayIndexOutofBoundsException: Index 0 out of bounds for length 0

这是我得到的唯一错误。

在批处理脚本中,文件使用

java -cp MyFile.jar com.mycomapnny.example.Main "path of where to put output"

我认为这与需要争论有关。但是我不确定要传递什么参数,因为我看不到主类。

任何帮助,将不胜感激。我可以尝试提供任何其他信息。

标签: javajarindexoutofboundsexception

解决方案


推荐阅读