001 /* 002 Copyright (C) 2003 Adam Olsen 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU General Public License as published by 006 the Free Software Foundation; either version 1, or (at your option) 007 any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU General Public License for more details. 013 014 You should have received a copy of the GNU General Public License 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 017 */ 018 019 package com.valhalla.jbother; 020 021 import javax.swing.JOptionPane; 022 import java.util.*; 023 import java.io.File; 024 025 /** 026 * JBother is a groovy Jabber client 027 * 028 * @author Adam Olsen (arolsen@gmail.com) 029 * @version 1.0 030 */ 031 public class JBother 032 { 033 public static final String JBOTHER_VERSION = "0.8.4b2cvs"; 034 public static String settingsDir = System.getProperty( "user.home" ) + File.separatorChar + ".jbother"; 035 public static String profileDir = JBother.settingsDir + File.separatorChar + "profiles"; 036 037 /** 038 * This is the main class, it basically just provides a loading point for the login 039 * screen - and also allows arguments to be passed from the command line. 040 * 041 * It checks the java version and if it's not greater than 1.4, it exits. 042 * 043 * @see com.valhalla.settings.Arguments 044 * @param args arguments passed via the command line 045 */ 046 public static void main( String args[] ) 047 { 048 String version = System.getProperty( "java.version" ); 049 StringBuffer buf = new StringBuffer(); 050 051 //we have to check the version this way because java versions < 1.4 didn't have 052 //regular expressions (what a bite) 053 int dots = 0; 054 for( int i = 0; i < version.length(); i++ ) 055 { 056 if( version.charAt( i ) == '.' ) dots++; 057 if( dots >= 2 ) break; 058 059 buf.append( version.charAt( i ) ); 060 } 061 062 if( Double.parseDouble( buf.toString() ) < Double.parseDouble( "1.4" ) ) 063 { 064 ResourceBundle resources = ResourceBundle.getBundle( "JBotherBundle", Locale.getDefault() ); 065 066 JOptionPane.showMessageDialog( null, resources.getString( "jdk14Needed" ), 067 resources.getString( "javaVersionError" ), JOptionPane.WARNING_MESSAGE ); 068 069 System.exit( 1 ); 070 } 071 else { 072 com.valhalla.Logger.write( "Java version " + version + " ok" ); 073 com.valhalla.jbother.JBotherLoader.startJBother( args ); 074 } 075 } 076 }