看了好多方法 还是搞不明白 求助啊!!!
把一个java程序和jar打包成可以在没有jdk的电脑上也能运行的.exe文件。 弄了一晚上,无奈总是不成功 求个有经验的帮个忙打包一下。跪求!下面是程序!package
import java.util.Scanner;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("*****欢迎进入客富翁系统*****");
System.out.println(" 1.注册 ");
System.out.println(" 2.登录 ");
System.out.println(" 3.抽奖 ");
System.out.println("***************************");
System.out.println("请输入");
int e = (int) (Math.random() * 10000);
int f = (int) (Math.random() * 10000);
int c = (int) (Math.random() * 10000);
int d = (int) (Math.random() * 10000);
int g = (int) (Math.random() * 10000);
Scanner input = new Scanner(System.in);
int num = input.nextInt();
switch (num) {
case 1:
System.out.println("【奖客富翁系统>注册】");
System.out.println("继续吗?(Y/N)");
String a = input.next();
if (a.equals("Y")) {
System.out.println("请输入个人信息:");
System.out.print("用户名:");
String name = input.next();
System.out.print("密码:");
String pwd = input.next();
System.out.println("注册成功,请记好你的会员卡号");
System.out.println("用户名 密码 会员卡号");
System.out.print(name + " " + pwd + " ");
int rand = (int) (Math.random() * 10000);
System.out.println(rand);
System.out.println("继续吗?(Y/N)");
String b = input.next();
if (b.equals("Y")) {
System.out.println("*****欢迎进入客富翁系统*****");
System.out.println(" 1.注册 ");
System.out.println(" 2.登录 ");
System.out.println(" 3.抽奖 ");
System.out.println("***************************");
System.out.println("请输入");
int num1 = input.nextInt();
switch (num1) {
case 1:System.out.print("请输入用户名");
String name5 = input.next();
System.out.print("请输入密码");
String pwd5 = input.next();
if(name.equals(name5)){
System.out.println("用户已被注册");
}
break;
case 2:
System.out.print("请输入用户名");
String name1 = input.next();
System.out.print("请输入密码");
String pwd1 = input.next();
if (pwd.equals(pwd1) && name.equals(name1)) {
System.out.println("欢迎你:" + name);
System.out.println("*****欢迎进入客富翁系统*****");
System.out.println(" 1.注册 ");
System.out.println(" 2.登录 ");
System.out.println(" 3.抽奖 ");
System.out.println("***************************");
System.out.println("请输入");
int num2 = input.nextInt();
switch (num2) {
case 3:
System.out.println("请输入会员卡号");
int vip = input.nextInt();
if (vip == e) {
System.out.println("中奖了");
} else if (vip == f) {
System.out.println("中奖了");
} else if (vip == c) {
System.out.println("中奖了");
} else if (vip == d) {
System.out.println("中奖了");
} else if (vip == g) {
System.out.println("中奖了");
} else
System.out.println("非常遗憾没中奖");
System.out.println("中奖号码为" + " " + g + " " + c
+ " " + d + " " + e + " " + f);
break;
default:
break;
}
}
else {
System.out.println("用户名或密码错误请重新输入(你还可以输入两次)");
System.out.print("请输入用户名");
String name2 = input.next();
System.out.print("请输入密码");
String pwd2 = input.next();
if (pwd.equals(pwd2) && name.equals(name2)) {
System.out.println("欢迎你:" + name);
System.out.println("*****欢迎进入客富翁系统*****");
System.out.println(" 1.注册 ");
System.out.println(" 2.登录 ");
System.out.println(" 3.抽奖 ");
System.out
.println("***************************");
System.out.println("请输入");
int num3 = input.nextInt();
switch (num3) {
case 3:
System.out.println("请输入会员卡号");
int vip = input.nextInt();
if (vip == e) {
System.out.println("中奖了");
} else if (vip == f) {
System.out.println("中奖了");
} else if (vip == c) {
System.out.println("中奖了");
} else if (vip == d) {
System.out.println("中奖了");
} else if (vip == g) {
System.out.println("中奖了");
} else
System.out.println("非常遗憾没中奖");
System.out.println("中奖号码为" + " " + g + " "
+ c + " " + d + " " + e + " " + f);
break;
default:
break;
}
} else {
System.out.println("用户名或密码错误请重新输入(你还可以输入两次)");
System.out.print("请输入用户名");
String name3 = input.next();
System.out.print("请输入密码");
String pwd3 = input.next();
if (pwd.equals(pwd3) && name.equals(name3)) {
System.out.println("欢迎你:" + name);
System.out.println("*****欢迎进入客富翁系统*****");
System.out.println(" 1.注册 ");
System.out.println(" 2.登录 ");
System.out.println(" 3.抽奖 ");
System.out
.println("***************************");
System.out.println("请输入");
int num4 = input.nextInt();
switch (num4) {
case 3:
System.out.println("请输入会员卡号");
int vip = input.nextInt();
if (vip == e) {
System.out.println("中奖了");
} else if (vip == f) {
System.out.println("中奖了");
} else if (vip == c) {
System.out.println("中奖了");
} else if (vip == d) {
System.out.println("中奖了");
} else if (vip == g) {
System.out.println("中奖了");
} else
System.out.println("非常遗憾没中奖");
System.out.println("中奖号码为" + " " + g
+ " " + c + " " + d + " " + e
+ " " + f);
break;
default:
break;
}
} else
System.out
.println("用户名或密码错误请重新输入(你还可以输入两次)");
}
}
break;
default:
break;
}
} else if (b.equals("N")) {
System.out.println("系统退出,谢谢使用!");
} else
System.out.println("系统退出,谢谢使用!");
} else if (a.equals("N")) {
System.out.println("系统退出,谢谢使用!");
} else
System.out.println("系统退出,谢谢使用!");
break;
case 2:
System.out.println("");
break;
case 3:
System.out.println("");
break;
default:
System.out.println("您的输入有误");
break;
}
}
}
一个抽奖的系统,用java做的。