Index: java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/gui/MainWin.java
===================================================================
--- java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/gui/MainWin.java	(revision 755)
+++ java/AEInstaller2-Updater/src/net/oni2/aeinstaller/updater/gui/MainWin.java	(revision 756)
@@ -14,4 +14,5 @@
 import javax.swing.JFrame;
 import javax.swing.JLabel;
+import javax.swing.JOptionPane;
 import javax.swing.JProgressBar;
 import javax.swing.SwingWorker;
@@ -111,7 +112,23 @@
 		@Override
 		protected Status doInBackground() throws Exception {
-			Thread.sleep(2000);
+			step.setText("Waiting for AEI to close");
+			int i = 0;
+			while (!checkWritable() && i < 20) {
+				i++;
+				Thread.sleep(500);
+			}
+
+			if (i >= 20) {
+				JOptionPane
+						.showMessageDialog(
+								null,
+								"Could not update because the main file of AEI was locked.\nPerhaps you are still running an instance of AEI?",
+								"Could not update!", JOptionPane.ERROR_MESSAGE);
+				System.exit(1);
+				return null;
+			}
+
 			step.setText("Updating");
-			
+
 			SVN svn = new SVN();
 			try {
@@ -132,4 +149,18 @@
 			}
 			return null;
+		}
+
+		private boolean checkWritable() {
+			File aei = new File(new File(Paths.getInstallerPath(), "bin"),
+					"AEInstaller2.jar");
+			File temp = new File(new File(Paths.getInstallerPath(), "bin"),
+					"temp.jar");
+			if (!aei.exists())
+				return true;
+			if (aei.renameTo(temp)) {
+				temp.renameTo(aei);
+				return true;
+			}
+			return false;
 		}
 
