java和javaw之间的区别 [英] Difference between java and javaw

查看:190
本文介绍了java和javaw之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了解 java.exe javaw.exe 之间的区别。我通过
Java.exe和Javaw.exe之间的区别来阅读

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

据说 java.exe 用于控制台和 javaw .exe 用于窗口应用程序。
在其他一些帖子中提到控制台在 javaw 中不可用。

There it is stated that java.exe is for console and javaw.exe is for window application. In some other post it is mentioned that console is not available in javaw.

但我不知道当我运行Tomcat服务器并在进程资源管理器中查看其进程时,我看到 javaw.exe ,即使tomcat是一个控制台应用程序。

but I wonder when I run Tomcat server and see its process in process explorer I see javaw.exe even though tomcat is a console application.

推荐答案

java和javaw命令状态


java和javaw工具通过启动JRE并加载指定的类来启动Java应用程序。

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

javaw 命令与 java 相同,但 javaw 没有
关联的控制台窗口。当您不希望显示命令
提示窗口时,请使用 javaw

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.

javaw 启动器会显示一个窗口,如果失败则会显示错误信息。
如果是Tomcat,则不会请参阅运行Win32控制台应用程序,类似于启动Eclipse,使用javaw.exe。

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();
            }
        });
    }
}

第1步: C: \> java JavavsJavaw
(命令行等待应用程序响应,直到它关闭)
步骤2: C:\> javaw JavavsJavaw
(应用程序启动并且命令行立即退出并准备好用于
下一个命令)

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)

这篇关于java和javaw之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆