Could not find or load main class with a Jar File

后端 未结 16 1234
有刺的猬
有刺的猬 2020-12-01 09:09

I\'m trying to load a jar using

@echo off
java -jar Test.jar
pause

With the manifest of

Manifest-Version: 1.0
Main-Class:          


        
16条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 09:46

    This is very difficult to debug without complete information.

    The two most likely-looking things at this point are that either the file in the jar is not stored in a directory WITHIN THE JAR, or that it is not the correct file.

    You need to be storing TestClass.class - some people new at this store the source file, TestClass.java.

    And you need to create the jar file so that TestClass.class appears with a path of classes. Make sure it is not "/classes". Use zip to look at the file and make sure it has a path of "classes".

提交回复
热议问题