我创建了一个代码和一个可执行文件,这样我就可以在没有Eclipse的情况下运行它。但是,当我双击java可执行文件时,没有任何反应。我怎样才能解决这个问题?如果有人想知道这是代码。我知道它看起来很脏我非常抱歉。它完美地运行
import java.util.Scanner;
public class work {
public static void main(String[]args) {
Scanner cin = new Scanner(System.in);
int loop = 0;
System.out.println("How to use: \n>>only use whole numbers for orginial price\n>>enter percentages in decimales "
+ "ie: .025 is 2.5%\n>>press 1 to reset percentages\n\n");
while (!(1==2)) {
System.out.println("What is the cash percentage?");
double cashP = cin.nextDouble();
System.out.println("What is the credit percentage (onto the cash)?");
double creditP = cin.nextDouble();
System.out.println("\n\n\n\n\n\n\n=========================\n>>>Everything is ready<<<");
loop = 1;
while (!(loop==0)) {
System.out.println("=========================\nWhat is orginial price?");
int og = cin.nextInt();
int omg = (int) ((og*cashP)+og);
int omg2 = (int) ((omg*creditP)+omg);
System.out.println("CASH: $"+omg+"\nCREDIT: $"+omg2);
if (og==1) {
loop = 0;System.out.println("\n\n\n\n\n\n\n=============================================\n>>>Cash and Credit percent"
+ "age areresetted<<<\n=============================================");}
}
}
}
}
编辑:我的问题已经解决了
答案 0 :(得分:-4)
请创建代码的Runnable Jar。请注意: https://www.wikihow.com/Create-an-Executable-File-from-Eclipse