Example usage for java.lang Package getPackage

List of usage examples for java.lang Package getPackage

Introduction

In this page you can find the example usage for java.lang Package getPackage.

Prototype

@CallerSensitive
@Deprecated(since = "9")
@SuppressWarnings("deprecation")
public static Package getPackage(String name) 

Source Link

Document

Finds a package by name in the caller's class loader and its ancestors.

Usage

From source file:Main.java

public static void main(String[] a) {
    Package p = Package.getPackage("java.lang");
    System.out.println("Name = " + p.getName());

    System.out.println("Implementation title = " + p.getImplementationTitle());

    System.out.println("Implementation vendor = " + p.getImplementationVendor());

    System.out.println("Implementation version = " + p.getImplementationVersion());
}

From source file:PackageInfo.java

public static void main(String[] args) {
    Package p = Package.getPackage("java.lang");

    System.out.println("Name = " + p.getName());

    System.out.println("Implementation title = " + p.getImplementationTitle());

    System.out.println("Implementation vendor = " + p.getImplementationVendor());

    System.out.println("Implementation version = " + p.getImplementationVersion());

    System.out.println("Specification title = " + p.getSpecificationTitle());

    System.out.println("Specification vendor = " + p.getSpecificationVendor());

    System.out.println("Specification version = " + p.getSpecificationVersion());
}

From source file:MainClass.java

public static void main(String[] args) {
    Package p = Package.getPackage("javax.swing");
    System.out.print("Swing Version: ");
    System.out.println(p.getSpecificationVersion());

    p = Package.getPackage("java.awt");
    System.out.print("AWT Version: ");
    System.out.println(p.getSpecificationVersion());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    System.out.println(pack.hashCode());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // check if this package is sealed
    System.out.println(pack.isSealed());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // check if this package is compatible with version 1.4.6
    System.out.println("" + pack.isCompatibleWith("1.4.6"));

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // print the specification title for this package
    System.out.println(pack.getSpecificationTitle());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // print the specification version for this package
    System.out.println(pack.getSpecificationVersion());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // print the package as a string
    System.out.println("" + pack.toString());

}

From source file:Main.java

public static void main(String[] args) {

    // get the java lang package
    Package pack = Package.getPackage("java.lang");

    // print the specification vendor for this package
    System.out.println(pack.getSpecificationVendor());

}