java - Running a .jar file without a GUI -
I have created this small program for the project on which I am working, and it works as if What I would like to do with Eclipse is a .jar file that I can double click and run it in my console. I was exported alaradi as a jar and a runner jar on the export menu, and both The time it takes to launch Java process in Task Manager Nc is, it uses both the CPU and memory, but does not show anything on my screen. I tried to compile with a command prompt, and this is only one thing, so my question is, can I apply a Java application without GUI? Because I think my problem is: I followed a tutorial to create a program, and it worked fine.
I am using Windows 8 64-bit (I'm due to some other software I'll have to use on my project). I am a newbie in this Java shopping, so if you please keep it as simple as possible; I really appreciate it. thank you in advanced.
Import java.util.Scanner; Public category dutasia {public stationary zero main (string [] args) {scanner sc = new scanner (System.in); Int Check = 1; System.out.println ("colomometer a millisecond nautilus \ n"); Do {int cm = 0; Int Salida = 0; While (salda! = 1) {try {System.out.println ("Escriba dasinciania n Kilometer:"); Cm = sc.nextInt (); Salada = 1; } Hold (exception e) {System.out.println ("Opción Inválida"); Sc = new scanner (System.in); Sc.reset (); }} // FIN DELL // DISTANCEIUS distance difference = cm = 50; // Conversation de centimetros-mapo one kilometro double MN = km / (1.8); // Conversation A Millise Nauticus // Calculus of Velocided System.out.print ("Destria Ann Kilometer:" + km + "km"); System.out.println ("Dexterix N Millus Antiquacus:" + MN + "M.N. \ N"); If (Mn / 5 <24) System.out.println ("Take a 5-minute trip:" + mn / 5 + "horas."); Else {System.out.println ("05 min Night:" + Mn / 5 + "Horse."); System.out.println ("05 min Night:" + (Mn / 5) / 24 + "DIS."); Println (); } If (Mn / 8 "24") System.out.println ("08 Month One Minute:" + MN / 8 + "Horse."); Else {System.out.println ("08 Months Night:" + Mn / 8 + "Horse."); System.out.println ("08 min Night:" + (Mn / 8) / 24 + "DIAS."); Println (); } If (Mn / 12 <24) {System.out.println ("12 minute trip:" + MN / 12 + "Horos."); Println (); } And {System.out.println ("12 minute trip:" + MN / 12 + "green"); System.out.println ("12 minutes Night:" + (Mn / 12) / 24 + "DIS."); Println (); }} While (check! = 0); Sc.close (); }}
The way Windows double-clicks a jar file, it handles Javaw
is designed to display a Java GUI program without to display the console window when I double click on the Java Console application, then I have a console The window looks like this:
javaw -jar "C: \ JavaPrograms \ SampleConsoleApp \ dist \ DistanceCalc.jar"
nothing else has been shown Goes to Because javaw is designed to launch a GUI window, but there is no one.
If you want to create a console application that has a double click, create a text file named launcher.bat
and place the launch command in that batch file:
java -jar "C: \ JavaPrograms \ SampleConsoleApp \ dist \ DistanceCalc .jar"
When you display the program from your IDE window to the output window, Netbeans In fact, it will generate the command line for you:
To run this application without the command from the command line, Shish to: java -jar "F: \ JavaPrograms \ IndexMaker \ dist \ IndexMaker.jar"
Comments
Post a Comment