package goodsbase;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import goodsbase.database.DbConnection;
import goodsbase.ui.MainWindow;

public class Main {
	
	private static final String loggingProps = "/logging.properties";
	
	private static final Logger log = Logger.getLogger(Main.class.getName());
	
	public static void main(String[] args) throws Exception, IOException {
		initLogger();
		setLookAndFeel();
		
		try {	
			DbConnection.init();
		} catch (Exception e) {
			log.log(Level.SEVERE, "Failed to start application", e);
			JOptionPane.showMessageDialog(null, "Failed to launch application.\n" 
					+ e.getMessage(), "Launch failed", JOptionPane.ERROR_MESSAGE);
			System.exit(1);
		}
			
		MainWindow.launch();		
	}
	
	private static void initLogger(){
		try {
			LogManager.getLogManager().readConfiguration(
					Main.class.getResourceAsStream(loggingProps));
		} catch (SecurityException | IOException e) {
			log.log(Level.WARNING, "Failed reading resource " + loggingProps , e);
		}		
	}
	
	private static void setLookAndFeel() {		
		try {
			UIManager.setLookAndFeel(
			        UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			log.log(Level.WARNING, "Failed setting look and feel" + loggingProps , e);
		}		
	}
	


}

@@ -11,24 +11,94 @@
 odsbase;%0D%0A%0D%0A
+import goodsbase.qserver.QServer;%0D%0Aimport goodsbase.ui.MainWindow;%0D%0A%0D%0A
 import java.
@@ -344,84 +344,8 @@
 %0D%0A%0D%0A
-import goodsbase.database.DbConnection;%0D%0Aimport goodsbase.ui.MainWindow;%0D%0A%0D%0A
 publ
@@ -557,38 +557,8 @@
 rgs)
- throws Exception, IOException
  %7B%0D%0A
@@ -610,30 +610,25 @@
 ry %7B
-%09
 %0D%0A%09%09%09
-DbConnection.ini
+QServer.star
 t();
@@ -663,206 +663,68 @@
 %0A%09%09%09
-log.log(Level.SEVERE, %22Failed to start application%22, e);%0D%0A%09%09%09JOptionPane.showMessageDialog(null, %22Failed to launch application.%5Cn%22 %0D%0A%09%09%09%09%09+ e.getMessage(), %22Launch failed%22, JOptionPane.ERROR_MESSAGE
+JOptionPane.showMessageDialog(null, %22Failed to start server%22
 );%0D%0A

change app start modified: src/goodsbase/Main.java