Have made a simple calculator using Java in both .jar and .exe formats using following method:
1) .java test with following code:
import java.util.*;
class Calccc
{
public static void main(String[] args)
{
Scanner sc= new Scanner(System.in);
System.out.print("Start number");
int a= sc.nextInt();
System.out.print("Enter second number- ");
int b= sc.nextInt();
System.out.print("Enter third number- ");
int c= sc.nextInt();
int d=a+b+c;
System.out.println("Total= " +d);
}
}
2) command prompt
javac Calccc.java
.
3) command prompt
jar cvf Calccc.jar Calccc.class
.
4) creating
manifest.txt in the same folder by
Main-Class: Calccc written in the .text plus an extra enter at the end.
5) command prompt
jar cmf manifest.txt Calccc.jar Calccc.class
.
Then using launch4j application version 3.8 to set a .exe file out of the jar file:
determinig the Output file:
determining Jar.
determining the minimum java -version
clicking on floppy disk icon and save the XML file
clicking on settings icon
But, neither the .jar file nor the .exe file work by double-clicking, but the .jar file works fine within the command line.
What I have tried:
Created multiple of times those fules, but the result didn't change. Also reinstalling Java didn't help either (Java 1.8.0 update 311)