Skip to content

Instantly share code, notes, and snippets.

/Main.java Secret

Created November 26, 2015 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d4f591fc041e676eb8d9 to your computer and use it in GitHub Desktop.
Save anonymous/d4f591fc041e676eb8d9 to your computer and use it in GitHub Desktop.
jigsaw package
package com.test.jigsaw;
import java.lang.instrument.Instrumentation;
public class Main {
public static void premain(String agentArgs, Instrumentation inst) {
Package pkg = Main.class.getPackage();
System.out.println(pkg.getImplementationTitle());
System.out.println(pkg.getImplementationVendor());
System.out.println(pkg.getImplementationVersion());
System.out.println(pkg.getSpecificationTitle());
System.out.println(pkg.getSpecificationVendor());
System.out.println(pkg.getSpecificationVersion());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.jigsaw</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Premain-Class>com.test.jigsaw.Main</Premain-Class>
<Boot-Class-Path>test-1.0-SNAPSHOT.jar</Boot-Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment