Difference between java and javaw

后端 未结 6 1171
感动是毒
感动是毒 2021-01-12 14:16

I searched to know the difference between java.exe and javaw.exe. I read through Difference between Java.exe and Javaw.exe.

There it is st

相关标签:
6条回答
  • It depends on how the Tomcat server is run. However, the way of configuring and starting Tomcat is out of the question. I could say that there's different options of doing that. If you starting Tomcat with java it runs like command line application which directs IO to the console. If you run it with javaw then it doesn't directs IO to the console. Many applications and servers has logging capabilities that could direct the output to the console. For this purposed better to use a command line instance of java instead of windows app. There's a reason to run javaw vs java is no logging, debugging messages, no error, stacktraces, exceptions, everything that System.out and System.err produce is visible while you running the application.

    0 讨论(0)
  • 2021-01-12 14:43

    In addition to the points stated, it is also can be noted that multi threaded programs can be run with java but javaw can run only single threaded programs!

    0 讨论(0)
  • 2021-01-12 14:47

    Difference between java.exe and javaw.exe commands is while running java program on windows you might have noticed that they will appear in task manager as either java.exe or javaw.exe, also in JAVA_HOME/bin we see these two java commands java.exe and javaw.exe, do you know difference between java.exe and javaw.exe

    Both java.exe and javaw.exe can execute java programs including jar file, only difference is that with java.exe you have a console executed and you need to wait until your java program finishes to run any other command on the other hand in case of javaw.exe no console or window is associated with execution.

    you can run your java program either by using java.exe or javaw.exe. Its suggested to use javaw.exe when you don't need command line window to appear. javaw launcher will display in error in a dialog box if execution fails.

    In summary main difference between java and javaw command is that with java.exe you will get a command prompt window but with javaw.exe there is no command prompt windows associated.

    0 讨论(0)
  • 2021-01-12 14:59

    The java and javaw commands states

    The java and javaw tools start a Java application by starting a JRE and loading a specified class.

    The javaw command is identical to java, except that javaw has no associated console window. Use javaw when you do not want a command prompt window to be displayed.

    The javaw launcher displays a window with error information if it fails. In case of Tomcat you won't see Win32 console application running, similarly to launch Eclipse, javaw.exe is used.

    Example : Write the following code :

    import javax.swing.*;
    public class JavavsJavaw {
        private static void renderGUI() {
            JFrame jFrame = new JFrame("HelloWorld Swing");
            jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel helloLabel = new JLabel("Hello World!");
            jFrame.getContentPane().add(helloLabel);
            jFrame.pack();
            jFrame.setVisible(true);
        }
    
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    renderGUI();
                }
            });
        }
    }
    

    Step 1 : C:\>java JavavsJavaw (the command-line waits for the application response till it closes) Step 2 : C:\>javaw JavavsJavaw (the application launches and the command line exits immediately and ready for
    next command)

    0 讨论(0)
  • 2021-01-12 14:59

    1. java.exe is the command where it waits for application to complete untill it takes the next command, javaw.exe is the command which will not wait for the application to complete. you can go ahead with another commands.

    2. java.exe is the console app while javaw.exe is windows app (console-less), The javaw.exe command is identical to java.exe, except that with javaw.exe there is no associated console window

    0 讨论(0)
  • 2021-01-12 15:01

    java.exe pops up a console window. javaw.exe does not.

    Both java.exe and javaw.exe can execute java programs including jar file, only difference is that with java.exe you have a console executed and you need to wait until your java program finishes to run any other command on the other hand in case of javaw.exe no console or window is associated with execution.

    Main difference between java and javaw command is that with java.exe you will get a command prompt window but with javaw.exe there is no command prompt windows associated.

    0 讨论(0)
提交回复
热议问题