Packaging Java programs with Installanywhere

Source: Internet
Author: User
Tags mysql free

UseInstallanywherePackingJAVAprogram

1. Start Installanywhere

Here, we create a new packaging project. Click Save As ... Save the project to the location you want.

2. After the project is saved, the following interface appears:

Click Advanced Designer ... For a detailed design, the following interface appears:

Fill in the basic information of the project here:

1. Project–info: Fill in the installation program title, installation file name, product name, other items may not be filled in.

2. Project–description: Fill in Product description, developer, Developer homepage, mail, etc.

3. Installer Ui–look&feel: Custom Installation Interface, title, title color, etc.

4. Organization: Organizational information, not yet studied.

5. Pre–install: Pre-installation, you can customize the installation steps, modify the title and content of each step.

6. Install: A critical step, first prepare the files you want to pack (Tomcat free installation, MySQL free installation, JDK)

Click Add Files ... Add the files you want to package, such as:

The file is added, and some of the necessary processing is done, such as creating a desktop shortcut after installation, adding a Start menu, and so on.

1. Create a shortcut: Click Add Action ...

Select Add

The following interface appears:

There are two system variables provided by Installanywhere that need to be explained:

$USER _install_dir$: Install directory, this is the most we use.

$DESKTOP $: Desktop

We choose New file to write on the path: $DESKTOP $$\ $ITSM 2.0.url (Itsm2.0.url for custom content)

Fill in additional text (URL mode)

[Internetshortcut]

Url= "Http://localhost:8080/itsm-webapp/pages"

iconfile= $USER _install_dir$$\$\bin\icon.ico

Hotkey=0

Iconindex=0

idlist=

This is a shortcut to the wording, Access path (URL: To be a website, an EXE file, etc.). IconFile: Icon Path)

This creates a shortcut with the following effect:

2. Create a Start Menu

Just like creating a desktop shortcut, under Add Action, create a file with the startup name: Start Itsm2.0.url, with the following effect:

Note: The file name is: $USER _shortcuts$$\ start Itsm2.0.url

The content is the same as the desktop shortcut.

$USER _shortcuts$ is a system variable, meaning a shortcut menu.

Of course, you can also add more menu items, the exact action is consistent with the above.

Here, you can already create an installation package that can be uninstalled, with a Start menu, and a desktop shortcut.

3. Handling Project Contents

Depending on what you've packaged, we've packaged the Tomcat, MySQL project, so to configure some content, first click on the Post-Install panel of the interface:

1. Specify the location of the JDK used by Tomcat, and operate in Tomcat6.0, Tomcat 7.0 basically, to modify (Catalina.bat, Service.bat, Startup.bat, Shutdown.bat)

Add four action types to:

Such as:

Click on the corresponding item,

Locate the file you want to modify (Catalina.bat, Service.bat, Startup.bat, Shutdown.bat)

Select Prepend (added in front) to add the response content to the corresponding file:

Catalina.bat:

REM--------------Added by Naikang start ...-----------------------

REM Set Java_home and Current_dir

Set Java_home= $USER _install_dir$$\ $jdk

Set current_dir= $USER _install_dir$

REM--------------Added by Naikang ending ...-----------------

Service.bat

REM--------------Added by Naikang start ...---------------------

REM Set Java_home and Current_dir

Set Java_home= $USER _install_dir$$\ $jdk

Set Catalina_home= $USER _install_dir$

REM--------------Added by Naikang ending ...----------------------

Startup.bat

REM--------------Added by Naikang start ...-----------------------------

REM Set Current_dir

Set Current_dir = $USER _install_dir$

REM--------------Added by Naikang ending ...------------------------

Shutdown.bat

REM--------------Added by Naikang start ...---------------------------

REM Set Current_dir

Set Current_dir = $USER _install_dir$

REM--------------Added by Naikang ending ...-----------------------

The Tomcat configuration is complete.

2. Configure MySQL

As above, MySQL needs to specify the data storage path, as with the Tomcat configuration, add an action to modify the file

Select the My.ini in the MySQL directory

Add in the Back (note: Select Append, fill in the following content)

[Mysqld]

Basedir= "$USER _install_dir$$\ $mysql"

Datadir= "$USER _install_dir$$\ $mysql \data"

Default-character-set=utf8

Now you need to register MySQL as a system service, and start, set to boot, the steps are as follows:

ADD Action Select: (Batch) fill in the following information:

Comment:start MySQL Service (custom)

Script:net Start MySQL5

Continue adding a batch action to set up the service boot.

Fill in the following information:

Comment:set MySQL Autorun

SCRIPT:SC config MySQL5 start= Auto

The MySQL configuration is complete.

3. Configure Tomcat, as above, to register Tomcat as a system service, start Tomcat, and set it to start automatically:

Registering a service, adding a batch action

Comment:install Tomcat Service

Script:call "$USER _install_dir$$\ $bin \service.bat" INSTALL Tomcat7

Start the service, same as new batch action

Comment:start Tomcat Service

Script:net Start TOMCAT7

Set up service to start automatically, same as new batch action

Comment:set Tomcat Autorun

SCRIPT:SC config Tomcat7 start= Auto

Note here: The space after the start= auto equals sign must have.

4, compile the project.

In the final step, compile the project:

Click on the build panel, where you can choose which installation package you want to build under the system, whether it contains VMS, etc. (select with VM under Windows, or you may not install on bare metal).

Finally select the installation package language, click Locales the following interface:

Select the language of the installation package and click on the wait below ...

5. Here, a program containing JDK, TOMCAT, and MySQL is packaged and finished.

Packaging Java programs with Installanywhere

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.