【发布时间】:2010-12-02 20:22:19
【问题描述】:
可能重复:
Is there a way to the hide win32 launch console from a Java program (if possible without JNI)
当我在 Windows 上的批处理文件中运行我的 java swing 应用程序时,控制台/命令窗口在我的 java 应用程序运行时保持打开状态。这会在我的任务栏上创建一个我不想拥有的额外窗口。但是当我关闭命令窗口时,它会停止我的 java 应用程序。有没有办法(可能通过批处理文件或命令行参数或对我的应用程序的代码更改)在启动我的 Swing 应用程序并在我的应用程序仍在运行时关闭控制台窗口后退出 java.exe?
主要方法如下:
public static void main(String args[]) {
ApplContext applContext = new ApplContext();
Throwable error = null;
try {
applContext.setUserConfigDir(args.length>0 ? args[0] : null);
applContext.loadData();
ApplTools.initLookAndFeel(Parameters.P_NIMBUS_LAF.of(applContext.getParameters()));
} catch (Throwable e) {
error = e;
}
// JWorkSheet is a JFrame.
new JWorkSheet(applContext, error).setVisible();
}
【问题讨论】:
-
我们可以看看你的代码的sn-p吗?最好是main方法。
-
这是这个问题的重复:stackoverflow.com/questions/264687/…
标签: java command-line