Statistics
| Revision:

svn-gvsig-desktop / trunk / install / launcher / izpack-launcher-1.3 / src / launcher.cpp @ 6705

History | View | Annotate | Download (18.8 KB)

1
/* Copyright (c) 2004 Julien Ponge - All rights reserved.
2
 * Some windows 98 debugging done by Dustin Sacks.
3
 *
4
 * Permission is hereby granted, free of charge, to any person obtaining a copy
5
 * of this software and associated documentation files (the "Software"), to
6
 * deal in the Software without restriction, including without limitation the
7
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8
 * sell copies of the Software, and to permit persons to whom the Software is
9
 * furnished to do so, subject to the following conditions:
10
 *
11
 * The above copyright notice and this permission notice shall be included in
12
 * all copies or substantial portions of the Software.
13
 *
14
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20
 * IN THE SOFTWARE.
21
 */
22
#include <wx/string.h>
23
#include <wx/file.h>
24
#include <wx/filename.h>
25
#include <wx/url.h>
26

    
27
#include "launcher.h"
28

    
29
#ifdef __UNIX__
30
  #include <stdlib.h>
31
  #include <map>
32
  #include <list>
33
#endif
34

    
35

    
36
/*
37
 * Helper function to run an external program. It takes care of the subtule
38
 * differences between the OS-specific implementations.
39
 *
40
 * @param cmd The command to run.
41
 * @return <code>true</code> in case of a success, <code>false</code> otherwise.
42
 */
43
bool run_external(wxString cmd)
44
{
45
 int code = wxExecute(cmd, wxEXEC_SYNC);
46
 return (code == 0);
47

    
48
}
49

    
50
bool run_external_async(wxString cmd)
51
{
52
 return (wxExecute(cmd, wxEXEC_ASYNC) != 0);
53
}
54

    
55
bool string_to_bool(wxString value, bool defaultValue){
56
 bool returnValue = defaultValue;
57
 if (value != wxEmptyString)
58
    if (
59
       value.CmpNoCase("s")   == 0  ||
60
       value.CmpNoCase("si")  == 0  ||
61
       value.CmpNoCase("1")   == 0  ||
62
       value.CmpNoCase("y")   == 0  ||
63
       value.CmpNoCase("yes") == 0
64
       ) 
65
    {
66
       returnValue = true;
67
    } else {
68
       returnValue = false;
69
    }
70
  return returnValue;
71
}
72

    
73
long LAUNCHAPP_TIMER_ID = wxNewId();
74

    
75
BEGIN_EVENT_TABLE(LauncherApp, wxApp)
76
    EVT_TIMER(LAUNCHAPP_TIMER_ID, LauncherApp::OnTimer)
77
END_EVENT_TABLE()
78

    
79

    
80
/* Main Application $Revision: 6705 $
81
 *
82
 * $Id: launcher.cpp 6705 2006-08-09 09:03:34Z jmvivo $
83
 */
84
LauncherApp::LauncherApp()
85
  : wxApp()
86
{
87
  APPLICATION_NAME = wxString("gvSIG Install-Launcher");
88
  completed = false;
89

    
90
  SetAppName(_( APPLICATION_NAME ));
91
  loadParams();
92
}
93

    
94
void LauncherApp::echo(const wxString &msg) 
95
{
96
  wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), wxOK);
97
  dlg.ShowModal();
98
}
99

    
100
void LauncherApp::notifyToUser(const wxString &msg) 
101
{
102
  wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), wxOK | wxICON_INFORMATION);
103
  dlg.ShowModal();
104
}
105

    
106

    
107
LauncherApp::~LauncherApp()
108
{
109

    
110
}
111

    
112
void LauncherApp::loadParams()
113
{
114
  cfgName = wxString( "launcher.ini" );
115

    
116
  wxFileInputStream in( cfgName );
117
  wxFileConfig cfg( in );
118
  wxString downloadEnabled;
119
  wxString launchJarAsync;
120
  wxString askForCheckingProcess;
121

    
122
  cfg.Read( "jar",                    &paramsJar,                wxEmptyString);
123
  cfg.Read( "jre",                    &paramsJre,                wxEmptyString);
124
  cfg.Read( "downloadJre",            &paramsJreDownload,        wxEmptyString);
125
  cfg.Read( "jai",                    &paramsJai,                wxEmptyString);
126
  cfg.Read( "downloadJai",            &paramsJaiDownload,        wxEmptyString);
127
  cfg.Read( "jai_io",                 &paramsJaiIo,              wxEmptyString);
128
  cfg.Read( "downloadJai_io",         &paramsJaiIoDownload,      wxEmptyString);
129
  cfg.Read( "jre_version",            &paramsJreVersion,         wxEmptyString);
130
  cfg.Read( "jre_version_prefered",   &paramsJreVersionPrefered, wxEmptyString);
131
  cfg.Read( "jarParams",              &paramsJarParams,          wxEmptyString);
132
  cfg.Read( "downloadEnabled",        &downloadEnabled,          wxEmptyString);
133
  cfg.Read( "launchJarAsync",         &launchJarAsync,           wxEmptyString);
134
  cfg.Read( "askForCheckingProcess",  &askForCheckingProcess,    wxEmptyString);
135
  
136
  //procesamos el parametro booleano 'downloadEnabled'
137
  paramsEnabledDownload =string_to_bool(downloadEnabled,false);
138
  //procesamos el parametro booleano 'launchJarAsync'
139
  paramsLaunchJarAsync =string_to_bool(launchJarAsync,false);
140
  //procesamos el parametro booleano 'askForCheckingProcess'
141
  paramsAskForCheckingProcess=string_to_bool(askForCheckingProcess,true);
142
  
143
  if (paramsJar == wxEmptyString )
144
  {
145
    error(_("The configuration file '") + cfgName + _("' does not contain a jar file entry."));
146
  }
147
  if (paramsJreVersionPrefered == wxEmptyString ) {
148
     paramsJreVersionPrefered = wxString(paramsJreVersion);
149
  }
150
}
151

    
152
void LauncherApp::error(const wxString &msg)
153
{
154
  wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), wxOK | wxICON_ERROR);
155
  dlg.ShowModal();
156
  exit(1);
157
}
158

    
159
void LauncherApp::confirm(const wxString &msg)
160
{
161
  int response;
162
  wxMessageDialog dlg(0, msg, _(APPLICATION_NAME), wxOK | wxCANCEL | wxICON_QUESTION );
163
  response = dlg.ShowModal();
164
  if (response != wxID_OK) {
165
    notifyToUser(_("Canceled by user"));
166
    exit(1);
167
  }
168
}
169
bool LauncherApp::confirmYesNoCancel(const wxString &msg,const int yesDefault = true)
170
{
171
  int response;
172
  long maskDefault;
173
  if (yesDefault) {
174
     maskDefault = wxYES_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION;
175
  } else {
176
     maskDefault = wxNO_DEFAULT | wxYES_NO | wxCANCEL | wxICON_QUESTION;       
177
  }
178
  wxMessageDialog dlg(0, msg, _(APPLICATION_NAME),  maskDefault);
179
  response = dlg.ShowModal();
180
  if (response != wxID_YES && response != wxID_NO) {
181
    notifyToUser(_("Canceled by user"));
182
    exit(1);
183
  }
184
  return (response == wxID_YES);
185
 
186
}
187

    
188

    
189

    
190
bool LauncherApp::OnInit()
191
{
192
  isStatusDialogVisible = false;
193
  locale.Init();
194
  locale.AddCatalog("launcher");
195

    
196
  statusDialog = new StatusDialog( APPLICATION_NAME );
197

    
198
  statusDialog->Centre();
199
  statusDialog->Show(TRUE);
200
  isStatusDialogVisible = true;
201

    
202
  showStatusMsg(_("Intializing..."));
203
  
204
  myTimer = new wxTimer(this,LAUNCHAPP_TIMER_ID);
205
  myTimer->Start(150,true);
206
  
207
  return true;
208
  /*
209

210
  if (!searchJRE())
211
  {
212
    jreInstall();
213
  }
214

215
  fixSystemJREConfig();
216

217
  jaiInstall();
218

219
  jaiIoInstall();
220

221
  runJRE();
222

223
  exit(0);    
224
  
225
  return false;
226
  */
227
}
228

    
229
void LauncherApp::fixSystemJREConfig(){
230
  showStatusMsg(_("Updating the system..."));
231
  //actualizamos CurrentVersion
232
  wxString baseKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft"
233
                     "\\Java Runtime Environment\\";
234
                     
235
  wxString genericVersion = paramsJreVersion.Left(3);
236
  
237
  wxString baseKeyGeneric = baseKey + genericVersion + "\\";
238
  wxString baseKeyVersion = baseKey + localVersionToUse + "\\";
239

    
240
  wxRegKey *pRegKey = new wxRegKey(baseKey);
241
  if( !pRegKey->Exists() ) {
242
    error(_("JRE not found."));
243
  }
244
  //pRegKey->SetValue("CurrentVersion",genericVersion); // **********
245
  
246
  // compiamos el contenido de la rama de la version
247
  // que queremos a la generica (1.4 o 1.5 o ...)
248
  wxRegKey *pRegKeyGeneric = new wxRegKey(baseKeyGeneric);
249
  wxRegKey *pRegKeyVersion = new wxRegKey(baseKeyVersion);
250
  
251
  if ( !pRegKeyGeneric->Exists() ){
252
    pRegKeyGeneric->Create();  
253
  }
254
  wxString tempKey;
255
  wxString tempValue;
256
  size_t nValues;
257
    
258
  //pRegKeyGeneric->SetValue("hola","generico");
259
  //pRegKeyVersion->SetValue("hola","version");
260
  
261
  pRegKeyVersion->GetKeyInfo(NULL,NULL,&nValues,NULL);
262
  long pos = 1;
263
  pRegKeyVersion->GetFirstValue(tempKey,pos);
264
  for(unsigned i=0;i<nValues;i++)        {
265
      //echo("copy " + tempKey);
266
      pRegKeyVersion->QueryValue(tempKey,tempValue);
267
      pRegKeyGeneric->SetValue(tempKey,tempValue);
268
      pRegKeyVersion->GetNextValue(tempKey,pos);
269
  }
270
    
271
  
272
  //copiamos el java.exe a Windows/System32
273
  //wxString source = javaHome + "\\bin\\java.exe";
274
  //wxString target = getenv("windir"); 
275
  //target = target + "\\system32\\java.exe";
276
  
277
  //bool isOk = wxCopyFile(source, target, true);
278
  //if (!isOk) {
279
  //  error(_("Error perform copy ") + source + _(" to ") + target);
280
  //}
281
  
282
}
283

    
284

    
285
bool LauncherApp::compareVersions(const wxString localVersion, const wxString requireVersion)
286
{
287
    bool result  = (localVersion.Cmp(requireVersion) == 0);
288
    /*
289
        if (requireVersion.Len() > localVersion.Len() )        {   
290
        
291
                result = (localVersion.Find(requireVersion) == 0);
292
        }
293
        else 
294
        {
295
                result = (requireVersion.Find(localVersion) == 0);
296
        }
297
        */
298

    
299
    /*
300
        if (result) {
301
            echo("localversion = '" + localVersion +"' requireVersion = '"+ requireVersion +"' ==> true");
302
    } else {
303
       echo("localversion = '" + localVersion +"' requireVersion = '"+ requireVersion +"' ==> false");
304
    }
305
    */
306
     
307
        return result;
308
}
309

    
310

    
311
bool LauncherApp::searchJRE()
312
{
313
  showStatusMsg(_("Searching for JRE..."));
314
  wxString version("");
315

    
316
  // Windows[tm] registry lookup
317
  wxString baseKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft"
318
                     "\\Java Runtime Environment\\";
319

    
320
  wxRegKey bKey(baseKey);
321
  if (!bKey.Exists())  {
322
     return false;
323
  }
324

    
325
  if (!bKey.QueryValue("CurrentVersion", version)){
326
     return false;
327
  }
328
  
329
  if (version == "1.1") {
330
     return false;
331
  }
332

    
333
  if (!compareVersions(version, paramsJreVersionPrefered)){
334
        //Nos recorremos las versiones instaladas
335
        version = "";
336
        wxString strTemp;
337
        wxRegKey sKey(baseKey);
338
        if (sKey.HasSubKey(paramsJreVersionPrefered)) {
339
      version = wxString(paramsJreVersionPrefered);
340
    } else {              
341
          for(unsigned i=20;i>1;i--) {
342
        strTemp = wxString::Format(paramsJreVersion + "_%02d",i);
343
        if (sKey.HasSubKey(strTemp)) {
344
                        version = strTemp;
345
                        break;
346
                }
347
          }               
348
    }
349
  }
350

    
351
        
352
  if (version == "") {
353
     return false;
354
  }            
355
  localVersionToUse = version;
356
  wxRegKey vKey(baseKey + version);
357

    
358
  if (!vKey.QueryValue("JavaHome", javaHome)){
359
     return false;
360
  }
361
  int osVerMayor;
362
  int osVerMinor;
363

    
364
  wxGetOsVersion(&osVerMayor,&osVerMinor);
365
  if (osVerMayor < 5) {
366
    javaExecPath = javaHome + "\\bin\\java";
367
  }else{
368
    javaExecPath = javaHome + "\\bin\\javaw";
369
  }
370
  /*
371
  echo("paramsJreVersion=" + paramsJreVersion);
372
  echo("paramsJreVersionPrefered=" + paramsJreVersionPrefered);
373
  echo("localVersionToUse=" + localVersionToUse);
374
  echo("javaHome=" +javaHome);
375
  echo("javaExecPath=" +javaExecPath);
376
  */
377
  return true;
378
}
379

    
380
void LauncherApp::runJRE()
381
{
382
  showStatusMsg(_("Launching instalation..."));
383
  if (!wxFile::Exists(paramsJar))
384
  {
385
    error(_("The jar-file in the configuration file ") + cfgName + _(" does exist."));
386
  }
387

    
388
  wxString cmd = javaExecPath + paramsJarParams + wxString(" -jar ") + paramsJar;
389
  if (paramsLaunchJarAsync) {
390
      if (!run_external_async(cmd))
391
      {
392
        error(_("The jar-file ") + paramsJar + _(" could not be executed." ));
393
      }
394
  } else {
395
      if (!run_external(cmd))
396
      {
397
        error(_("The jar-file ") + paramsJar + _(" could not be executed." ));
398
      }  
399
  }
400

    
401
  completed = true;
402
}
403

    
404
void LauncherApp::jreInstall()
405
{
406
  showStatusMsg(_("Preparing to install JRE..."));
407
  
408
  if (!checkInstallerFile(paramsJre, paramsJreDownload,_("Java JRE version ")+paramsJreVersion))
409
  {
410
    error(_("The JRE could not be setup."));  
411
  }
412

    
413
  showStatusMsg(_("Installing JRE..."));
414
  if (!run_external(paramsJre))
415
  {
416
    error(_("The JRE could not be setup."));
417
  }
418
  if (!searchJRE()) {
419
    error(_("The JRE could not be setup."));
420
  }    
421
}
422

    
423

    
424
// Not used
425
void LauncherApp::netDownload()
426
{
427
  wxString browser;
428

    
429
#ifdef __WINDOWS__
430
  // We use the default browser.
431
  browser = "rundll32 url.dll,FileProtocolHandler ";
432
#endif
433

    
434
#ifdef __UNIX__
435
  // We try some browsers and use the first successful one.
436
  std::list<std::pair<wxString, wxString> > commands;
437
  std::pair<wxString, wxString> cmd;
438
  cmd.first = "konqueror "; cmd.second = "konqueror -v";
439
  commands.push_back(cmd);
440
  cmd.first = "mozilla -splash "; cmd.second = "mozilla -v";
441
  commands.push_back(cmd);
442
  cmd.first = "firefox -splash "; cmd.second = "firefox -v";
443
  commands.push_back(cmd);
444
  cmd.first = "firebird -splash "; cmd.second = "firebird -v";
445
  commands.push_back(cmd);
446
  cmd.first = "opera "; cmd.second = "opera -v";
447
  commands.push_back(cmd);
448
  cmd.first = "netscape "; cmd.second = "netscape -v";
449
  commands.push_back(cmd);
450
  std::list<std::pair<wxString, wxString> >::iterator it;
451
  for (it = commands.begin(); it != commands.end(); ++it)
452
  {
453
    if (wxExecute(it->second, wxEXEC_SYNC) == 0)
454
    {
455
      browser = it->first;
456
      break;
457
    }
458
  }
459
#endif
460
  /*
461
  if (run_external(browser + paramsDownload))
462
  {
463
    completed = true;
464
  }
465
  else
466
  {
467
    error(_("Could not find a web browser."));
468
  }
469
  */
470
}
471

    
472
IMPLEMENT_APP(LauncherApp)
473

    
474

    
475
void LauncherApp::jaiInstall()
476
{
477
  bool isOK;
478
  showStatusMsg(_("Checking JAI Library..."));
479
  
480
  wxString baseKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft"
481
                     "\\Java Runtime Environment\\";
482

    
483
  wxString currentVersion;
484
  wxRegKey *pRegKey = new wxRegKey(baseKey);
485
  if( !pRegKey->Exists() )
486
    error(_("JRE not found."));
487
  if (!pRegKey->QueryValue("CurrentVersion", currentVersion)) error(_("JRE not found."));
488
  
489
  isOK=true;  
490
  if (!checksJai()) {
491
      //confirm(_("JAI library is required, Install it?"));
492
      
493
      showStatusMsg(_("Preparing to install JAI Library..."));
494
      if (!checkInstallerFile(paramsJai, paramsJaiDownload, _("JAI Library")))
495
      {
496
        isOK=false;  
497
      } else {
498
        pRegKey->SetValue("CurrentVersion",localVersionToUse);
499
        showStatusMsg(_("Preparing to install JAI Library..."));
500
        if (run_external(paramsJai))
501
        {
502
          isOK=(checksJai());
503
        } else {
504
          isOK=false;
505
        }  
506
        pRegKey->SetValue("CurrentVersion",currentVersion);
507
      }
508
      
509
  }  
510
  if (!isOK) {
511
    error(_("The JAI could not be setup."));
512
  }
513
}
514

    
515
void LauncherApp::jaiIoInstall()
516
{
517
  bool isOK;
518
  showStatusMsg(_("Checking JAI imageIO Library..."));
519
  
520
  wxString baseKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft"
521
                     "\\Java Runtime Environment\\";
522

    
523
  wxString currentVersion;
524
  wxRegKey *pRegKey = new wxRegKey(baseKey);
525
  if( !pRegKey->Exists() )
526
    error(_("JRE not found."));
527
  if (!pRegKey->QueryValue("CurrentVersion", currentVersion)) error(_("JRE not found."));
528
  
529

    
530
  isOK=true;  
531
  if (!checksJaiIo()) {
532
      //confirm(_("JAI ImageIO library is required, Install it?"));
533
      
534
      showStatusMsg(_("Preparing to install JAI imageIO Library..."));
535
      if (!checkInstallerFile(paramsJaiIo, paramsJaiIoDownload,"JAI ImageIO Library"))
536
      {
537
        isOK=false;  
538
      } else {
539
        pRegKey->SetValue("CurrentVersion",localVersionToUse);
540
        showStatusMsg(_("Installing JAI imageIO Library..."));
541
        if (run_external(paramsJaiIo))
542
        {                                    
543
          isOK=(checksJaiIo());
544
        } else {
545
          isOK=false;        
546
        }
547
         pRegKey->SetValue("CurrentVersion",currentVersion);
548
      }
549
     
550
  }  
551
  if (!isOK) {
552
             error(_("The JAI imageIO could not be setup."));
553
  }
554
}
555

    
556
bool LauncherApp::checksJai(){
557
   return (wxFileExists(javaHome + "\\lib\\ext\\jai_core.jar"));
558
}
559

    
560
bool LauncherApp::checksJaiIo(){
561
   return (wxFileExists(javaHome + "\\lib\\ext\\jai_imageio.jar"));     
562
}
563

    
564
bool LauncherApp::downloadFileHttp(const wxString urlOfFile, const wxString filePath){
565

    
566
  bool isOk;
567
  //echo(urlOfFile);
568
  if (urlOfFile == wxEmptyString) {
569
     return false;
570
  }
571
  
572
  if (filePath == wxEmptyString) {
573
     return false;
574
  }
575
  
576
  wxURL url(urlOfFile);
577
  //echo("url open");
578
  wxInputStream *in_stream;
579

    
580
  in_stream = url.GetInputStream();
581
  //echo("in_stream open");
582
  if (!in_stream->IsOk()) {
583
     //echo("in_stream.IsOk == false");
584
     return false;
585
  }
586
  //echo("in_stream.IsOk == true");
587
  //echo("filePath =" + filePath);
588
  wxFileName fileName(filePath);
589
  
590
  wxArrayString dirs;
591
  
592
  dirs = fileName.GetDirs();
593
  wxString dir;
594
  wxFileName curDir(".");
595
  for (size_t i=0; i < dirs.GetCount(); i++) {
596
      dir = dirs.Item(i);
597
      curDir.AppendDir(dir);
598
      //echo("dir " + curDir.GetPath());
599
      if (!curDir.DirExists()) {
600
         //echo("creating dir");
601
         isOk = curDir.Mkdir();
602
         if (!isOk) {
603
            //echo("dir create no ok");
604
            return false;
605
         }
606
         
607
         //echo("dir create ok");
608
      }
609
  }
610
  
611
  wxFileOutputStream out_stream  = wxFileOutputStream(filePath);
612
  //echo("out_stream open");
613
  
614
  in_stream->Read(out_stream);
615
  
616
  
617
  isOk = (out_stream.IsOk() && in_stream->Eof());
618
  /*
619
  if (isOk) {
620
    echo("isOk = true");
621
  } else {
622
    echo("isOk = false");         
623
  }
624
  */
625
  delete in_stream;
626
  //echo("end");
627
  return isOk;
628

    
629
}
630

    
631
bool LauncherApp::checkInstallerFile(const wxString filePath, const wxString urlDownload, const wxString fileDescription) {
632
  if (!wxFile::Exists(filePath))
633
  {
634
    if (paramsEnabledDownload) 
635
    {
636
      wxString msg = _("Intalation require download this file:\n") + 
637
                     fileDescription + "\n" +
638
                     _("Do you want to continue?");
639
      confirm(msg);
640
      showStatusMsg(_("Downloading ") + fileDescription + "...");
641
      if (!downloadFileHttp(urlDownload,filePath)) 
642
      {
643
        return false;  
644
      }       
645
    }
646
    else
647
    {
648
      return false;  
649
    }
650

    
651
  }
652
  return true;
653
}
654

    
655
void LauncherApp::showStatusMsg(const wxString msg) {
656
  if (isStatusDialogVisible) {
657
     if (statusDialog->IsCanceled()) {
658
       notifyToUser(_("Canceled by user"));
659
       exit(1);
660
     }
661
     statusDialog->showStatus(msg);
662
  }
663
}
664

    
665
void LauncherApp::run(){
666
  bool doChecks = true;
667
  
668
  if (paramsAskForCheckingProcess) {
669
     wxString msg = _("Do you want to make checks of the application requisites?");
670
     doChecks = confirmYesNoCancel(msg,true);
671
  }
672
     
673

    
674
  if (doChecks) {
675

    
676
      if (!searchJRE())
677
      {
678
        jreInstall();
679
      }
680
    
681
      fixSystemJREConfig();
682
    
683
      jaiInstall();
684
    
685
      jaiIoInstall();
686
  } else {
687
    // No quiere comprobacion, por lo que solicitamos 
688
    wxString msgDir = _("Find de Java Virtual Machine executable file to run");
689
    /*
690
    wxFileDialog(
691
     wxWindow* parent,
692
     const wxString& message = "Choose a file",
693
     const wxString& defaultDir = "", 
694
     const wxString& defaultFile = "", 
695
     const wxString& wildcard = "*.*", 
696
     long style = 0, 
697
     const wxPoint& pos = wxDefaultPosition
698
     )
699
    */
700
    
701
    
702
    wxFileDialog dlg(
703
        0,
704
        msgDir,
705
        wxEmptyString,
706
        wxString("java.exe"),
707
        wxString("Java VM executable file (java.exe)|java.exe"),
708
        wxOPEN | wxFILE_MUST_EXIST,
709
        wxDefaultPosition
710
    );
711
    int response = dlg.ShowModal();  
712
    if (response != wxID_OK) {
713
       notifyToUser(_("Canceled by user"));
714
       exit(1);
715
    }
716
    //caragamos la variable con el eljecutable
717
    javaExecPath = dlg.GetPath();
718
    
719
    //generamos el path para el JavaHome (por si acaso)
720
    wxFileName fileName(javaExecPath);
721
    fileName.SetFullName("");
722
    fileName.AppendDir("..");
723
    fileName.Normalize();
724
    javaHome = fileName.GetPath();
725
  
726
  }
727

    
728
  runJRE();
729

    
730
  exit(0);    
731
     
732
}
733

    
734
void LauncherApp::OnTimer(wxTimerEvent& event) {     
735
     run();
736
}