-2

I created a code and a executable file so that I can run it without Eclipse. However when I double click on the java executable file, nothing happens. How can I fix this? Here is the code if anyone is wondering. I know it looks dirty im very sorry. It runs perfectly though

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=============================================");}
        }
    }
}

}

EDIT : my problem has been solved

azro
  • 53,056
  • 7
  • 34
  • 70
  • That part include the PATH that might be missing, for the rest, well we need more information. – AxelH Jun 18 '18 at 08:24
  • And for the console on executable jar (without console), see [What happens to “System.out.println()” in executable jar?](https://stackoverflow.com/a/28477682/4391450) – AxelH Jun 18 '18 at 08:25

1 Answers1

-4

Please create Runnable Jar of the code .Refer : https://www.wikihow.com/Create-an-Executable-File-from-Eclipse