1/3/2024 0 Comments Javaws exe![]() In other words, cmd is associated with the program at this time. When java starts the GUI program, cmd will wait for the program's response until the program terminates. When launched using javaw, the application launches and the command line exits immediately and ready for next command.īoth java.exe and javaw.exe can start GUI programs. We can execute the above GUI application using both java.exe and javaw.exe If we launch using java.exe, the command-line waits for the application response till it closes. So why does the title flash? Check javapapers, you will find that it will have such a sentence ![]() In other words, the console at this time is not associated with my application.Ĭontinue to check the task manager, you will find that javaw.exe does appear. After that, I clicked the button again and found that the console could not print out: Hello World. You will find the moment I click the command. In the gif below, please pay attention to the difference in cmd titles at the moment I click the command. View Image Use javaw to start my jar package Then check the task manager, you will find that java.exe does appear. ![]() Please pay attention to the arrow, it will be distinguished from javaw next. Use java to start my jar packageĪfter launching the program via java, I clicked the button and found that the console did output HelloWorld. For simplicity, I packaged my project into a jar in advance and placed it on the desktop. My current idea is to use the command line to start the program with java and javaw respectively, and check the effect by observing cmd and task manager. In order to operate, I wrote a simple GUI program, the effect is as followsīy clicking on a point in my button, the effect is: You can modify the contents of the button for the "Hello World", and output in the console in the HelloWorld. So here, we basically understand the difference between java.exe and javaw.exe, but what are the differences in actual operation? When do we not need to use the console? This situation is more common, and GUI (graphical user interface) is a common way of interaction. In other words, if we do not need to use the console, we can use javaw to start the application. If the program we write requires a console, then we can use java.exe to start the application. (), The printed things are in the console, that is to say, the console is a way for the computer to interact with people. If javaw fails to start the program, a dialog window will display the error message. If you don't want to use the console, you can use javaw. ![]() In other words, javaw.exe is basically java.exe, but javaw does not have an associated console. The javaw launcher will, however, display a dialog box with error information if a launch fails. Use javaw when you do not want a command prompt window to appear. The javaw command is identical to java, except that with javaw there is no associated console window. So, what is javaw.exe? The official Oracle documentation says so, java.exe is to make the compiled class file run. In other words, the job of java.exe is to start a java application by starting jre, loading a specific class file, and calling the main method of the class. It does this by starting the Java Runtime Environment (JRE), loading the specified class, and calling that class's main() method. The java command starts a Java application. Here I first quote the official Oracle documentation. java.exe and javaw.exe Preliminary identification class files to run, and the job of javac is to translate the. java files we write directly must be compiled into. exe files we talked about today are in the jdk file. Note that jdk contains jre, and the above four. So what is jdk? The full name of jdk is java development kit translated into Chinese is the java development kit, you have to use jdk if you want to develop java language programs. The full name of jre is java runtime environment, translated into Chinese is the java runtime environment, which means that a java file you write must have a jre to run. I don't understand now, so I won't be ugly). Although java has been used for a while, I didn't understand jdk and jre until yesterday (if we talk about it in depth, I will talk about jvm. There is also an official document Contents of JDK from Oracle. After checking a lot of information, I simply wrote my own summary for your reference.įirst of all, I first post my main reference article, one is, the other is the difference between java, javaw and javaws, the second article is a translation of the first article. I happened to encounter this problem when I executed the jar package with the command line recently.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |