我想让我的java程序可执行像.exe?

时间:2013-11-19 21:46:44

标签: java jar exe executable executable-jar

这是我的java代码...我想让它在编译一次后再次双击运行..! 请指导我如何制作这个..?

import java.util.Scanner;
public class Functions {
public static int addnumbers(){
Scanner input = new Scanner(System.in);
    int a,b;
    System.out.println("\nMethod Call - Addition");
    System.out.print("\nEnter a = ");
    a=input.nextInt();
    System.out.print("Enter b = ");
    b=input.nextInt();
    return(a+b);        
}
public static int subnumbers(){
Scanner input = new Scanner(System.in);
    int a,b;
    System.out.println("Method Call - Subtraction");
    System.out.print("\nEnter a = ");
    a=input.nextInt();
    System.out.print("Enter b = ");
    b=input.nextInt();
    return(a-b);        
}
public static int mulnumbers(){
Scanner input = new Scanner(System.in);
    int a,b;
    System.out.println("Method Call - Multiply");
    System.out.print("\nEnter a = ");
    a=input.nextInt();
    System.out.print("Enter b = ");
    b=input.nextInt();
    return(a*b);        
}
public static int quonumbers(){
Scanner input = new Scanner(System.in);
    int a,b;
    System.out.println("Method Call - Quotient");
    System.out.print("\nEnter a = ");
    a=input.nextInt();
    System.out.print("Enter b = ");
    b=input.nextInt();
    return(a/b);        
}
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int n;
System.out.println("**Calcultor**\n\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Quotient");
System.out.print("\nEnter no : ");
n=input.nextInt();
if(n==1) {
System.out.println("\nResult = "+addnumbers());
}
if(n==2) {
System.out.println("\nResult = "+subnumbers());
}
if(n==3) {
System.out.println("\nResult = "+mulnumbers());
}
if(n==4) {
System.out.println("\nResult = "+quonumbers());
}
System.out.println("\nControl exit!");
 }
}

告诉我任何办法......

1 个答案:

答案 0 :(得分:0)

这些程序包装Jar文件和依赖项,以便为Windows创建本机可执行文件。