有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

带有外部清单文件的java运行jar

我正在寻找一种经营一家公司的方法。jar文件包含java编译器,并且jar中没有清单

如果在这个过程中编译器忽略了jar中的旧清单,那么它也会很有帮助

使用该方法,我应该能够指定自定义主类和自定义类路径

其他方法也受欢迎


共 (1) 个答案

  1. # 1 楼答案

    i am searching for a way to run a .jar file with the java compiler and without having the manifest inside of the jar.

    您不能使用编译器运行Java应用程序,但可以在JRE和JVM中运行

    Also it would be helpful, if the old manifest from the jar is getting ignored from the compiler in that process.

    只是不要在构建中包含清单

    With that method i should be able to specify a custom Main-Class and a custom Class-Path.

    它已经可以从CLI执行。此外,创建了清单,因此您不必从CLI执行此操作。 但无论如何

    java -cp your/custom/class/path/here fully.qualified.name.of.Main
    

    你就完了。只需记住在类路径中也包括JAR文件