InstallShield: Create JSP + Tomcat + JDK + MySQL (Article 1)

Source: Internet
Author: User

I had nothing to do after work. I studied InstallShield packaging and gained some small experience. I would like to share with you. I am also a newbie. Sorry for the error. I hope it will help you.

This article is mainly about packaging JSP + Tomcat + JDK + MySQL.

First download the InstallShield software. There are many versions, but the script code is almost the same.

Next, download Tomcat green and MySQL green, and copy the installed JDK.

Put the database file under the MySQL directory again, and put the project under tomcat.

Everything is ready, and we will start ....

1. Set the installation language. After selecting a project, if you select multiple installation languages, you must first select the installation language when installing the program. We do not need to write a script here. If there is only one language, the Select language dialog box is not displayed during installation.

2. Set the startup screen. You only need to change the default image, but the image name cannot be changed.

3. The code for determining the operating system is as follows:

Function onbegin ()
Begin
If (! Sysinfo. bintel) then
Szmsg = "Tip: This software can only run on Intel series Processors! /N the installer will terminate ";
MessageBox (szmsg, severe );
Abort;
Endif;
If (sysinfo. Win9x. bwinme |
Sysinfo. winnt. bwinnt |
Sysinfo. winnt. bwinnt4 |
Sysinfo. winnt. bwin2000) then
Szmsg = "Tip: This software can only run on Win9x to ensure that the program works properly! /N continue installation? ";
If (! Askyesno (szmsg, no) then
Abort;
Endif;
Endif;
End

4. Operating System memory capacity judgment

If (getsysteminfo (extendedmemory, nvfreemem, svresult) <0) then
MessageBox ("memory detection failed. The installer will be terminated !. ", Severe );
Abort;
Endif;
If (nvfreemem <16384) then
Szmsg = "This software can only be installed on machines with 16 MB or more memory. /N sorry, the memory available on this machine is less than 16 MB! /N the installer will be terminated! "; MessageBox (szmsg, severe );
Abort;
Endif;

5. Generate the serial number (first obtain the disk sequence and then generate the serial number)

Number volumenum;
// Before using the getvolumeinformation API you will need to prototype it
Prototype kernel32.getvolumeinformation (byref string, byref string, number, byref string, number );
// Prototype for the custom installscript Function
Prototype getvolumeserial ();
// Function Definition
Function getvolumeserial ()
String lprootpathname;
String lpvolumenamebuffer;
Number nvolumenamesize;
Number lpvolumeserialnumber;
Number lpmaximumcomponentlength;
Number lpfilesystemflags;
String lpfilesystemnamebuffer;
Number nfilesystemnamesize;
Bool apireturn;
Begin
Lprootpathname = "D ://";
Nvolumenamesize = 60;
Nfilesystemnamesize = 60;
// Apireturn = getvolumeinformation (lprootpathname, lpvolumenamebuffer, nvolumenamesize, lpvolumeserialnumber, lpmaximumcomponentlength, lpfilesystemflags, lpfilesystemnamebuffer, nfilesystemnamesize );
Apireturn = getvolumeinformation (lprootpathname, lpvolumenamebuffer, nvolumenamesize, lpvolumeserialnumber, lpmaximumcomponentlength, lpfilesystemflags, lpfilesystemnamebuffer, nfilesystemnamesize );


If (apireturn) then

Volumenum = lpvolumeserialnumber;
If (volumenum <0) then
Volumenum = 0-volumenum;
Endif;
// Numtostr (volumenum, lpvolumeserialnumber );
// Sprintfbox (information, "", "volume = % S/nvolume serial = % d", lprootpathname, lpvolumeserialnumber );
If (volumenum> 2139999999-135792468) then

// Volumenum = 123456789;
Volumenum = volumenum-volumenum/100000000*100000000;
Endif;

Else

Volumenum= 123456789;
// MessageBox ("failure.", 0 );
Endif;
End;
Prototype getnumstring ();
Function getnumstring ()
Number numspace;
Number nummen;
String tmpstring;
Begin
// Tmpnum = getjavaswhandle (hwnd_install); // install the handle of the Main Window
// Numspace = getdiskspace ("C: //"); // specify the free disk space on the drive
Numspace = getdiskspaceex ("C: //", Kbytes); // specify the free disk space bytes on the drive
// Nummen = getmemfree (); // memory size available for an application running in Microsoft Windows
Nummen = getdiskspaceex ("D: //", Kbytes );
If numspace <10000 then
Numberspace = 11360000;
Else
Numspace = (numspace-numspace/10000*10000) * 10000;
Endif;
If nummen <10000 then
Nummen = 7521;
Else
Nummen = nummen-nummen/10000*10000;
Endif;
Volumenum = 100000000 + numspace + nummen;

// Numtostr (tmpstring, volumenum );
// MessageBox (tmpstring, 0 );
End;

 

Getvolumeserial ();
Tmpnum = volumenum;
Tmpnum = tmpnum-tmpnum/100*100;
Numtostr (tmpcheckstring, tmpnum );
If (tmpcheckstring = "0") then
Tmpcheckstring = "0x ";
Endif;
Checkstring = "B" + tmpcheckstring + "_";
Tmpnum = volumenum/100;
Tmpnum = tmpnum-tmpnum/100*100;
Numtostr (tmpcheckstring, tmpnum );
If (tmpcheckstring = "0") then
Tmpcheckstring = "0x ";
Endif;
Checkstring = checkstring + "K" + tmpcheckstring + "_";
Tmpnum = volumenum/10000;
Tmpnum = tmpnum-tmpnum/100*100;
Numtostr (tmpcheckstring, tmpnum );
If (tmpcheckstring = "0") then
Tmpcheckstring = "0x ";
Endif;
Checkstring = checkstring + "X" + tmpcheckstring + "_";
Tmpnum = volumenum/1000000;
Tmpnum = tmpnum-tmpnum/100*100;
Numtostr (tmpcheckstring, tmpnum );
If (tmpcheckstring = "0") then
Tmpcheckstring = "0x ";
Endif;
Checkstring = checkstring + "T" + tmpcheckstring;

// MessageBox (checkstring, information );

// Change the volumenum Value
// B3242_k423_x342_t3423
Volumenum = volumenum + 135792468;
Numtostr (localnum, volumenum );

 

This article introduces you here first. Please refer to the next article.


 


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.