Example usage for java.lang Package getImplementationVersion

List of usage examples for java.lang Package getImplementationVersion

Introduction

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

Prototype

public String getImplementationVersion() 

Source Link

Document

Return the version of this implementation.

Usage

From source file:Main.java

public static void main(String[] args) {

    // create a package object for java.lang package
    Package pack = Package.getPackage("java.lang");

    // get the implementation version
    System.out.println(pack.getImplementationVersion());
}

From source file:com.rcaspar.fitbitbat.App.java

/**
 * Program entry point.//w w  w . j a v a 2 s.  co  m
 *
 * @param args CLI args
 */
public static void main(final String[] args) {
    log.debug("main() - args={}", Arrays.asList(args));
    final Args arguments = new Args();
    try {
        new JCommander(arguments, args);

        final GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext(
                "classpath:application-context.xml");
        applicationContext.registerShutdownHook();
        applicationContext.start();

        final Package appPackage = App.class.getPackage();
        log.info("=== {} v.{} started ===", appPackage.getImplementationTitle(),
                appPackage.getImplementationVersion());

        final FitBitBat fitBitBat = applicationContext.getBean(FitBitBat.class);
        if (fitBitBat.checkCredentials(arguments.getPin())) {
            fitBitBat.startAsync();
        } else {
            log.error("Bad pin: {}", arguments.getPin());
        }
    } catch (final OAuthException ex) {
        System.err.println(ex.getMessage());
        System.exit(1);
    } catch (final ParameterException ex) {
        new JCommander(arguments).usage();
        System.exit(-1);
    } catch (final Exception ex) {
        log.error("Cannot startup", ex);
        System.exit(-2);
    }
}

From source file:at.nullpointer.trayrss.TrayRSS.java

/**
 * Initialization of the Spring Context//from  w  w  w .  j a  v a 2  s .c  o m
 * 
 * @param args
 */
public static void main(final String[] args) {

    final Package trayRssPackage = TrayRSS.class.getPackage();
    ReferenceCollection.getInstance()
            .setTrayrssAppTitle("TrayRSS " + trayRssPackage.getImplementationVersion());

    if (args.length != 0) {
        if (args[0].equals("-debug")) {
            Logger.getRootLogger().setLevel(Level.DEBUG);
        } else {
            System.out.println("You may start the program within the " // NOPMD
                    + "debug mode by using -debug as parameter.");
        }
    }

    ReferenceCollection.getInstance().setContext(new ClassPathXmlApplicationContext("SpringBeans.xml"));

    TrayRSS trayRss = ReferenceCollection.getInstance().getContext().getBean(TrayRSS.class);
    trayRss.start(args);
}

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:editeurpanovisu.EditeurPanovisu.java

/**
 * @param args the command line arguments
 *//*from   w  w w  .  j  av  a 2 s.  c  o m*/
public static void main(String[] args) {
    Package pack = Package.getPackage("editeurpanovisu");
    System.setProperty("file.encoding", "UTF-8");
    numVersion = pack.getImplementationVersion();
    systemeExploitation = System.getProperty("os.name");
    //Properties properties = System.getProperties();
    //properties.list(System.out);
    launch(args);
}

From source file:com.callidusrobotics.MythosRL.java

private static String getImplementationVersion() {
    final Package myPackage = MythosRL.class.getPackage();

    if (myPackage.getImplementationTitle() == null || myPackage.getImplementationVersion() == null) {
        return "Roguelike Debug Version";
    }//from   w  ww. j a va 2 s  .co  m

    return myPackage.getImplementationTitle() + " " + myPackage.getImplementationVersion();
}

From source file:cz.jirutka.validator.collection.internal.HibernateValidatorInfo.java

/**
 * Returns version of the Hibernate Validator determined from the package
 * info on classpath.//  w ww. j a va2  s.com
 *
 * <p>Version number is parsed as: 5.1.1.Final -> 511, 5.2.0-SNAPSHOT -> 520.</p>
 *
 * @return A parsed version number, or {@link Integer#MAX_VALUE} if could not be determined.
 */
public static int getVersion() {

    Package pkg = HibernateValidator.class.getPackage();

    if (pkg != null) {
        String version = pkg.getImplementationVersion();
        String title = pkg.getImplementationTitle();

        if (isNotEmpty(version) && "hibernate-validator".equals(title)) {
            LOG.info("Found Hibernate Validator {}", version);
            return parseVersion(version);
        }
    }
    LOG.warn("Could not determine Hibernate Validator version");
    return Integer.MAX_VALUE;
}

From source file:com.bstek.dorado.core.DoradoAbout.java

/**
 * ??//from w  w  w . j  ava  2s .c  om
 */
public static String getVersion() {
    Package pkg = DoradoAbout.class.getPackage();
    String version = null;
    if (pkg != null)
        version = pkg.getImplementationVersion();
    if (StringUtils.isEmpty(version))
        version = instanceId;
    return version;
}

From source file:org.springframework.security.core.SpringSecurityCoreVersion.java

public static String getVersion() {
    Package pkg = SpringSecurityCoreVersion.class.getPackage();
    return (pkg != null ? pkg.getImplementationVersion() : null);
}