@@ -139,72 +139,78 @@ public void process(double percent) {
139139 }
140140
141141 public void launchApplication () {
142- Platform .runLater (() -> stage .close ());
143- try {
144- Thread .sleep (100 );
145- } catch (InterruptedException e1 ) {
146- // TODO Auto-generated catch block
147- e1 .printStackTrace ();
148- }
149- String command ;
150- try {
151- command = JvmManager .getCommandString (project , repoName , myVersionString ,downloadJsonURL ,sizeOfJson ,progress ,bindir );
152- } catch (Exception e ) {
153- // TODO Auto-generated catch block
154- e .printStackTrace ();
155- System .exit (1 );
156- return ;
157- }
158- //
159- // for (int i = 4; i < args.length; i++) {
160- // command += " " + args[i];
161- // }
162- try {
163- myVersionFile .createNewFile ();
164- } catch (IOException e ) {
165- // TODO Auto-generated catch block
166- e .printStackTrace ();
167- }
168- BufferedWriter writer ;
169- try {
170- writer = new BufferedWriter (new FileWriter (myVersionFileString ));
171- writer .write (myVersionString );
172- writer .close ();
173- } catch (IOException e ) {
174- // TODO Auto-generated catch block
175- e .printStackTrace ();
176- }
177-
178- String fc =!isWin ()?
179- command + " " + bindir + myVersionString + "/" + jarName +"" :
180- command + " \" " + bindir + myVersionString + "/" + jarName +"\" " ;
181- for (String s :argsFromSystem ) {
182- fc +=(" " +s );
183- }
184-
185- String finalCommand =fc ;
186- System .out .println ("Running:\n \n " +finalCommand +"\n \n " );
142+ Platform .runLater (() -> {
143+ yesButton .setDisable (true );
144+ noButton .setDisable (true );
145+ });
187146 new Thread (() -> {
147+ String command ;
188148 try {
189- Process process = Runtime .getRuntime ().exec (finalCommand );
190- BufferedReader reader = new BufferedReader (new InputStreamReader (process .getErrorStream ()));
191- String line ;
192- while ((line = reader .readLine ()) != null && process .isAlive ()) {
193- System .out .println (line );
194- try {
195- Thread .sleep (10 );
196- } catch (InterruptedException e ) {
197- // TODO Auto-generated catch block
198- e .printStackTrace ();
199- }
200- }
201- reader .close ();
202- System .out .println ("LatestFromGithubLaunch clean exit" );
203- System .exit (0 );
149+ command = JvmManager .getCommandString (project , repoName , myVersionString ,downloadJsonURL ,sizeOfJson ,progress ,bindir );
150+ } catch (Exception e ) {
151+ // TODO Auto-generated catch block
152+ e .printStackTrace ();
153+ System .exit (1 );
154+ return ;
155+ }
156+ Platform .runLater (() -> stage .close ());
157+ try {
158+ Thread .sleep (100 );
159+ } catch (InterruptedException e1 ) {
160+ // TODO Auto-generated catch block
161+ e1 .printStackTrace ();
162+ }
163+ //
164+ // for (int i = 4; i < args.length; i++) {
165+ // command += " " + args[i];
166+ // }
167+ try {
168+ myVersionFile .createNewFile ();
204169 } catch (IOException e ) {
205170 // TODO Auto-generated catch block
206171 e .printStackTrace ();
207172 }
173+ BufferedWriter writer ;
174+ try {
175+ writer = new BufferedWriter (new FileWriter (myVersionFileString ));
176+ writer .write (myVersionString );
177+ writer .close ();
178+ } catch (IOException e ) {
179+ // TODO Auto-generated catch block
180+ e .printStackTrace ();
181+ }
182+
183+ String fc =!isWin ()?
184+ command + " " + bindir + myVersionString + "/" + jarName +"" :
185+ command + " \" " + bindir + myVersionString + "/" + jarName +"\" " ;
186+ for (String s :argsFromSystem ) {
187+ fc +=(" " +s );
188+ }
189+
190+ String finalCommand =fc ;
191+ System .out .println ("Running:\n \n " +finalCommand +"\n \n " );
192+ new Thread (() -> {
193+ try {
194+ Process process = Runtime .getRuntime ().exec (finalCommand );
195+ BufferedReader reader = new BufferedReader (new InputStreamReader (process .getErrorStream ()));
196+ String line ;
197+ while ((line = reader .readLine ()) != null && process .isAlive ()) {
198+ System .out .println (line );
199+ try {
200+ Thread .sleep (10 );
201+ } catch (InterruptedException e ) {
202+ // TODO Auto-generated catch block
203+ e .printStackTrace ();
204+ }
205+ }
206+ reader .close ();
207+ System .out .println ("LatestFromGithubLaunch clean exit" );
208+ System .exit (0 );
209+ } catch (IOException e ) {
210+ // TODO Auto-generated catch block
211+ e .printStackTrace ();
212+ }
213+ }).start ();
208214 }).start ();
209215 }
210216
0 commit comments