Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    1

    Installazione

    Salve a tutti,
    ho creato un pacchetto di installazione con un tool automatico createinstall free. Poichè la mia è un apllicazione java vorrei sapere se c'è modo di verificare se nel pc in cui vado ad installare la mia applicazione c'è un jre... come si fa? qualcuno può aiutarmi?
    Grazie mille
    Gianluca

  2. #2
    In NSIS si fa una cosa del genere:

    Codice PHP:
    Function DetectJRE
      Exch 
    $0    Get version requested  
            
    Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
      Push 
    $1    ; $Java version string (ie 1.5.0)
      
    Push $2    ; $Javahome
      Push 
    $3    ; $and $4 are used for checking the major/minor version of java
      Push 
    $4
      MessageBox MB_OK 
    "Detecting JRE"
      
    ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
      
    MessageBox MB_OK "Read : $1"
      
    StrCmp $"" DetectTry2
      ReadRegStr 
    $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
      
    MessageBox MB_OK "Read 3: $2"
      
    StrCmp $"" DetectTry2
      
    Goto GetJRE
     
    DetectTry2
    :
      
    ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
      
    MessageBox MB_OK "Detect Read : $1"
      
    StrCmp $"" NoFound
      ReadRegStr 
    $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
      
    MessageBox MB_OK "Detect Read 3: $2"
      
    StrCmp $"" NoFound
     
    GetJRE
    :
    ; $
    version requested. $version found. $javaHome
      MessageBox MB_OK 
    "Getting JRE"
      
    IfFileExists "$2\bin\java.exe" 0 NoFound
      StrCpy 
    $$0 1            Get major versionExample: $1.5.0now $1
      StrCpy 
    $$1 1            ; $major version requested, $major version found
      MessageBox MB_OK 
    "Want $3 , found $4"
      
    IntCmp $$3 0 FoundOld FoundNew
      StrCpy 
    $$0 1 2
      StrCpy 
    $$1 1 2            Same as above. $3 is minor version requested, $4 is minor version installed
      MessageBox MB_OK 
    "Want $3 , found $4" 
      
    IntCmp $$3 FoundNew FoundOld FoundNew
     
    NoFound
    :
      
    MessageBox MB_OK "JRE not found"
      
    Push "0"
      
    Goto DetectJREEnd
     
    FoundOld
    :
      
    MessageBox MB_OK "JRE too old: $3 is older than $4"
    ;  Push ${TEMP2}
      
    Push "-1"
      
    Goto DetectJREEnd  
    FoundNew
    :
      
    MessageBox MB_OK "JRE is new: $3 is newer than $4"
     
      
    Push "$2\bin\java.exe"
    ;  Push "OK"
    ;  Return
       Goto 
    DetectJREEnd
    DetectJREEnd
    :
        ; 
    Top of stack is return valuethen r4,r3,r2,r1
        Exch    
    ; => r4,rv,r3,r2,r1,r0
        Pop 
    $4    ; => rv,r3,r2,r1r,r0
        Exch    
    ; => r3,rv,r2,r1,r0
        Pop 
    $3    ; => rv,r2,r1,r0
        Exch     
    ; => r2,rv,r1,r0
        Pop 
    $2    ; => rv,r1,r0
        Exch    
    ; => r1,rv,r0
        Pop 
    $1    ; => rv,r0
        Exch    
    ; => r0,rv
        Pop 
    $0    ; => rv 
    FunctionEnd 
    Non dovrebbe essere difficile portare i controlli sul Registry (una volta note le chiavi) nel tuo sistema di installazione.
    "Se riesci a passare un pomeriggio assolutamente inutile in modo assolutamente inutile, hai imparato a vivere."

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.