From 9437758ae9dc62fd116e7d3a221d98ac7b35cc16 Mon Sep 17 00:00:00 2001 From: xyli Date: Fri, 3 Mar 2023 14:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9ETestJarClass=20=E4=B8=BB?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/TestJarClass.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/TestJarClass.java b/src/test/java/TestJarClass.java index 01f2d8a..d5f05c3 100644 --- a/src/test/java/TestJarClass.java +++ b/src/test/java/TestJarClass.java @@ -16,4 +16,14 @@ import java.util.jar.Manifest; public class TestJarClass { + + + public static void main(String[] args) throws IOException { + JarFile jarFile = new JarFile("D:\\SystemDocument\\Desktop\\springboot-test-jar-0.0.1-SNAPSHOT.jar"); + + Manifest manifest = jarFile.getManifest(); + Attributes attributes = manifest.getMainAttributes(); + String mainClass = attributes.getValue("Main-Class"); + System.out.println(mainClass); + } } -- Gitee