1 /**
2 * JSpiff
3 * -----------------
4 * Copyright 2005-2006 Emil A. Lefkof III
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.jspiff;
23
24 import java.util.Properties;
25
26 /**
27 * Simple executable class that is used as the Main-Class in the JSpiff
28 * jar. Outputs version information and other information about the environment
29 * on which the jar is being executed.
30 * <p>
31 * Copyright (c) 2006
32 * Melloware, Inc. <http://www.melloware.com>
33 * @author Emil A. Lefkof III <info@melloware.com>
34 * @version 1.0
35 */
36 @SuppressWarnings("")
37 public class Main {
38
39 /**
40 * Private constructor to make sure this class is never instantiated.
41 *
42 */
43 private Main() {
44
45 }
46
47 /** Main method that does what the class level javadoc states. */
48 public static void main(String[] argv) {
49 System.out.println("JSpiff version \"" + getProjectVersion() + "\"");
50
51 System.out.println("Running on java version \"" + System.getProperty("java.version") + "\""
52 + " (build " + System.getProperty("java.runtime.version") + ")"
53 + " from " + System.getProperty("java.vendor"));
54
55 System.out.println("Operating environment \"" + System.getProperty("os.name") + "\""
56 + " version " + System.getProperty("os.version") + " on " + System.getProperty("os.arch"));
57
58 System.out.println("For more information on JSpiff please visit http://www.melloware.com");
59 }
60
61 /**
62 * Attempts to read the version number out of the pom.properties. If not found
63 * then RUNNING.IN.IDE.FULL is returned as the version.
64 * <p>
65 * @return the full version number of this application
66 */
67 private static String getProjectVersion() {
68 String version;
69
70 try {
71 final Properties pomProperties = new Properties();
72 pomProperties.load(Main.class.getResourceAsStream("/META-INF/maven/com.melloware/jspiff/pom.properties"));
73 version = pomProperties.getProperty("version");
74 } catch (Exception e) {
75 version = "RUNNING.IN.IDE.FULL";
76 }
77 return version;
78 }
79 }