@@ -32,13 +32,17 @@ public static void main(String[] args) {
3232 int localVersion = getLocalVersion ();
3333 int downloadedVersion = getDownloadedJarVersion ();
3434
35- if (remoteVersion > downloadedVersion && remoteVersion > localVersion )
35+ if (remoteVersion > downloadedVersion && remoteVersion > localVersion ) {
36+ System .out .println ("Starting remote version." );
3637 startJar (downloadRemoteJar ().getAbsolutePath ());
37- else if (downloadedVersion > remoteVersion
38- && downloadedVersion > localVersion )
38+ } else if (downloadedVersion > remoteVersion
39+ && downloadedVersion > localVersion ) {
40+ System .out .println ("Starting cached version." );
3941 startJar (DOWNLOADED_FILE .getAbsolutePath ());
40- else
42+ } else {
43+ System .out .println ("Starting local version." );
4144 startLocal ();
45+ }
4246 /*
4347 * if (getLocalVersion() > -1) { if (isRemoteNewer()) {
4448 * startJar(downloadRemoteJar().getAbsolutePath()); } else {
@@ -144,10 +148,16 @@ private static void startJar(String path) {
144148 System .out .println ("Starting jar " + path + "." );
145149 ProcessBuilder pb = new ProcessBuilder ("java" , "-classpath" , path ,
146150 SortAlgorithmVisualizer .class .getName ());
151+ pb .inheritIO ();
147152 try {
148- pb .start ();
153+ Process p = pb .start ();
154+ p .waitFor ();
155+
149156 } catch (IOException e ) {
150157 e .printStackTrace ();
158+ } catch (InterruptedException e ) {
159+ // TODO Auto-generated catch block
160+ e .printStackTrace ();
151161 }
152162 }
153163
0 commit comments