Java programs export to. jar files, build. exe executables, and package as executable installers (can run on computers without Java environment)--take the personal income tax Calculator for example

Source: Internet
Author: User

Kerugaki-Blog Park

http://www.cnblogs.com/kailugaji/

Software that needs to be prepared:

Jdk,eclipse,exe4j,inno Setup Compiler

First, the Java source program--Personal income tax:

Package Math;import Javax.swing.JOptionPane;
Kerugaki Http://www.cnblogs.com/kailugaji/public class Wrrtax {public static void main (string args[]) {string Mone Y Enter your income double x, y; Double tax=0; Joptionpane.showmessagedialog (NULL, "personal income tax calculator \ n" + "Producer:" + "Kerugaki \ n" + "http://www.cnblogs.com/kailugaji/\n" + "Welcome!" "); Money = Joptionpane.showinputdialog ("Please Enter your income (unit: Yuan):"); Convert numbers from type String to type int x=double.parsedouble (money); y=x-3500; if (y<=0) tax=0; else if (y<=1500) tax=y*0.03; else if ((y>1500) & (y<=4500)) tax=1500*0.03+ (y-1500) *0.1; else if ((y>4500) & (y<=9000)) tax=1500*0.03+3000*0.1+ (y-4500) *0.2; else if ((y>9000) & (y<=35000)) tax=1500*0.03+3000*0.1+4500*0.2+ (y-9000) *0.25; else if ((y>35000) & (y<=55000)) tax=1500*0.03+3000*0.1+4500*0.2+35000*0.25+ (y-35000) *0.3; else if ((y>55000) & (y<=80000)) tax=1500*0.03+3000*0.1+4500*0.2+35000*0.25+55000*0. (y-55000) *0.35; else if (y>80000) tax=1500*0.03+3000*0.1+4500*0.2+35000*0.25+55000*0.3+800000*0.35+ (y-80000) *0.45; Joptionpane.showmessagedialog (NULL, "You should pay tax:" +tax + "Yuan!) "); Joptionpane.showmessagedialog (NULL, "Thank you for using, Goodbye!") "); }}

Second, export the program to a. jar file:

1. Click "Export":

2.

3.

4.

Iii. making. exe files:

1: Locate the JRE folder where you installed the Java Runtime Program

2. Create a new folder on the desktop: WRR, place the JRE folder with the. jar file in the WRR folder

3. Using the EXE4J software:

4.

5.

6.

7.

8.

9.

10. Default

11. Copy the entire "WRR" folder to someone else's PC and click on the Kailugaji.exe file to run it without installing the JRE file.

Four, packaged into the installation package program, like a small software, can be installed anywhere on the machine to run:

1. Open Inno Setup Compiler

2.

3.

4. Determination of the way

5. In the "WRR" folder just generated an output folder, there is a Setup.exe file, which is successful, so that you can install the Setup.exe on any PC to execute.

6. Copy the Setup.exe file to another PC that does not have the JRE file installed:

7.

8.

9.

10.

11. Install, ready to use.

Java programs export to. jar files, build. exe executables, and package as executable installers (can run on computers without Java environment)--take the personal income tax Calculator for example

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.