Search in sources :

Example 1 with JarFileArchive

use of fish.payara.micro.boot.loader.archive.JarFileArchive in project Payara by payara.

the class Launcher method createArchive.

protected final Archive createArchive() throws Exception {
    ProtectionDomain protectionDomain = getClass().getProtectionDomain();
    CodeSource codeSource = protectionDomain.getCodeSource();
    URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
    String path = (location == null ? null : location.getSchemeSpecificPart());
    if (path == null) {
        throw new IllegalStateException("Unable to determine code source archive");
    }
    File root = new File(path);
    if (!root.exists()) {
        throw new IllegalStateException("Unable to determine code source archive from " + root);
    }
    return new JarFileArchive(root);
}
Also used : ProtectionDomain(java.security.ProtectionDomain) JarFileArchive(fish.payara.micro.boot.loader.archive.JarFileArchive) CodeSource(java.security.CodeSource) URI(java.net.URI) File(java.io.File)

Aggregations

JarFileArchive (fish.payara.micro.boot.loader.archive.JarFileArchive)1 File (java.io.File)1 URI (java.net.URI)1 CodeSource (java.security.CodeSource)1 ProtectionDomain (java.security.ProtectionDomain)1