List of usage examples for java.lang Package getPackage
@CallerSensitive @Deprecated(since = "9") @SuppressWarnings("deprecation") public static Package getPackage(String name)
From source file:Main.java
public static void main(String args[]) { // create a package object for java.lang package Package pack = Package.getPackage("java.io"); System.out.println(pack.getAnnotation(Deprecated.class)); }
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 vendor System.out.println(pack.getImplementationVendor()); }
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 fully qualified name for this package System.out.println(pack.getName()); }
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: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 Title for lang package System.out.println(pack.getImplementationTitle()); }
From source file:Main.java
public static void main(String args[]) { // create a package object for java.lang package Package pack = Package.getPackage("java.io"); for (Annotation at : pack.getDeclaredAnnotations()) { System.out.println(at);//from w w w . j a v a 2 s . c o m } }
From source file:Main.java
public static void main(String args[]) { // create a package object for java.lang package Package pack = Package.getPackage("java.io"); for (Annotation at : pack.getAnnotations()) { System.out.println(at);/* w w w . j a v a 2 s . com*/ } }
From source file:Main.java
public static void main(String[] args) { try {/* w w w . ja v a2 s.co m*/ // get the java lang package Package pack = Package.getPackage("java.lang"); // check if this package is sealed URL url = new URL("http://www.oracle.com"); System.out.println("" + pack.isSealed(url)); } catch (MalformedURLException ex) { ex.printStackTrace(); } }
From source file:org.openscience.jchempaint.application.JChemPaint.java
@SuppressWarnings("static-access") public static void main(String[] args) { try {// ww w .j a v a2 s. com String vers = System.getProperty("java.version"); String requiredJVM = "1.5.0"; Package self = Package.getPackage("org.openscience.jchempaint"); String version = GT._("Could not determine JCP version"); if (self != null) version = JCPPropertyHandler.getInstance(true).getVersion(); if (vers.compareTo(requiredJVM) < 0) { System.err.println(GT._("WARNING: JChemPaint {0} must be run with a Java VM version {1} or higher.", new String[] { version, requiredJVM })); System.err.println(GT._("Your JVM version is {0}", vers)); System.exit(1); } Options options = new Options(); options.addOption("h", "help", false, GT._("gives this help page")); options.addOption("v", "version", false, GT._("gives JChemPaints version number")); options.addOption("d", "debug", false, "switches on various debug options"); options.addOption(OptionBuilder.withArgName("property=value").hasArg().withValueSeparator() .withDescription(GT._("supported options are given below")).create("D")); CommandLine line = null; try { CommandLineParser parser = new PosixParser(); line = parser.parse(options, args); } catch (UnrecognizedOptionException exception) { System.err.println(exception.getMessage()); System.exit(-1); } catch (ParseException exception) { System.err.println("Unexpected exception: " + exception.toString()); } if (line.hasOption("v")) { System.out.println("JChemPaint v." + version + "\n"); System.exit(0); } if (line.hasOption("h")) { System.out.println("JChemPaint v." + version + "\n"); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("JChemPaint", options); // now report on the -D options System.out.println(); System.out.println("The -D options are as follows (defaults in parathesis):"); System.out.println(" cdk.debugging [true|false] (false)"); System.out.println(" cdk.debug.stdout [true|false] (false)"); System.out.println(" user.language [ar|ca|cs|de|en|es|hu|nb|nl|pl|pt|ru|th] (en)"); System.out.println(" user.language [ar|ca|cs|de|hu|nb|nl|pl|pt_BR|ru|th] (EN)"); System.exit(0); } boolean debug = false; if (line.hasOption("d")) { debug = true; } // Set Look&Feel Properties props = JCPPropertyHandler.getInstance(true).getJCPProperties(); try { UIManager.setLookAndFeel(props.getProperty("LookAndFeelClass")); } catch (Throwable e) { String sys = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(sys); props.setProperty("LookAndFeelClass", sys); } // Language props.setProperty("General.language", System.getProperty("user.language", "en")); // Process command line arguments String modelFilename = ""; args = line.getArgs(); if (args.length > 0) { modelFilename = args[0]; File file = new File(modelFilename); if (!file.exists()) { System.err.println(GT._("File does not exist") + ": " + modelFilename); System.exit(-1); } showInstance(file, null, null, debug); } else { showEmptyInstance(debug); } } catch (Throwable t) { System.err.println("uncaught exception: " + t); t.printStackTrace(System.err); } }
From source file:nl.cad.tpsparse.Main.java
public static void main(String[] args) { Args params = new Args(); JCommander cmd = new JCommander(params); try {//from www. j a va 2 s . c o m cmd.parse(args); if (params.help || params.sourceFile == null) { String version = Package.getPackage("nl.cad.tpsparse").getImplementationVersion(); System.out.println("TPS-to-CSV : converts Clarion TPS files to CSV."); System.out.println("Version " + version + ""); System.out.println( "(C) 2012-2014 E.Hooijmeijer, Apache 2 licensed (https://www.apache.org/licenses/LICENSE-2.0.html)\n"); System.out.println("WARNING : This software is based on Reverse Engineered TPS Files."); System.out.println(" As such, its probably incomplete and may mis-interpret data."); System.out.println(" It is no replacement for any existing Clarion tooling."); System.out.println(" Check the output files thoroughly before proceeding.\n"); System.out.println("Commercial Clarion tooling is available at http://www.softvelocity.com/\n"); System.out.println("Typical use:"); System.out.println( " java -jar tps-to-csv.jar -s [source file or folder] -t [target file or folder] -sort -raw\n"); cmd.usage(); } else { if (params.sourceFile.isFile()) { parseFile(params); } else { if (params.targetFile != null && params.targetFile.isFile()) { throw new ParameterException( "If the source is a folder, the target must also be a folder."); } File[] files = listFiles(params.sourceFile); File targetBase = params.targetFile; for (File file : files) { params.sourceFile = file; params.targetFile = (targetBase == null ? null : new File(targetBase, file.getName() + ".csv")); parseFile(params); } } } // } catch (IOException ex) { System.out.println("Error reading TPS file: " + ex.getMessage()); } catch (UnsupportedCharsetException ex) { System.out.println("Unknown or unsupported characterset '" + ex.getCharsetName() + "'."); } catch (ParameterException ex) { System.out.println(ex.getMessage()); cmd.usage(); } }