View Javadoc

1   /**
2    * JIntellitype
3    * -----------------
4    * Copyright 2005-2008 Emil A. Lefkof III, Melloware Inc.
5    *
6    * I always give it my best shot to make a program useful and solid, but
7    * remeber that there is absolutely no warranty for using this program as
8    * stated in the following terms:
9    *
10   * Licensed under the Apache License, Version 2.0 (the "License");
11   * you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   *
14   *     http://www.apache.org/licenses/LICENSE-2.0
15   *
16   * Unless required by applicable law or agreed to in writing, software
17   * distributed under the License is distributed on an "AS IS" BASIS,
18   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   * See the License for the specific language governing permissions and
20   * limitations under the License.
21   */
22  package com.melloware.jintellitype;
23  
24  import java.util.Properties;
25  
26  /**
27   * Simple executable class that is used as the Main-Class in the JIntellitype 
28   * jar. Outputs version information and other information about the environment 
29   * on which the jar is being executed.
30   * <p>
31   * Copyright (c) 1999-2008
32   * Melloware, Inc. <http://www.melloware.com>
33   * @author Emil A. Lefkof III <info@melloware.com>
34   * @version 1.3.1
35   */
36  @SuppressWarnings("")
37  public final class Main {
38  
39      /**
40       * Private constructor to make sure this class is never instantiated.
41       *
42       */
43      private Main() {
44          // private constructor to make singleton.
45      }
46  
47      /** Main method that does what the class level javadoc states. */
48      public static void main(String[] argv) {
49          System.out.println("JIntellitype version \"" + getProjectVersion() + "\"");
50          System.out.println(" ");
51  
52          System.out.println("Running on java version \"" + System.getProperty("java.version") + "\""
53                             + " (build " + System.getProperty("java.runtime.version") + ")"
54                             + " from " + System.getProperty("java.vendor"));
55  
56          System.out.println("Operating environment \"" + System.getProperty("os.name") + "\""
57                             + " version " + System.getProperty("os.version") + " on " + System.getProperty("os.arch"));
58  
59          System.out.println("For more information on JIntellitype please visit http://www.melloware.com");
60      }
61  
62      /**
63       * Attempts to read the version number out of the pom.properties.  If not found
64       * then RUNNING.IN.IDE.FULL is returned as the version.
65       * <p>
66       * @return the full version number of this application
67       */
68      private static String getProjectVersion() {
69          String version;
70  
71          try {
72              final Properties pomProperties = new Properties();
73              pomProperties.load(Main.class.getResourceAsStream("/META-INF/maven/com.melloware/jintellitype/pom.properties"));
74              version = pomProperties.getProperty("version");
75          } catch (Exception e) {
76              version = "RUNNING.IN.IDE.FULL";
77          }
78          return version;
79      }
80  }