简体   繁体   English

System.out.println不输出到控制台

[英]System.out.println not outputting to console

I've been using Sop to try and debug some code, and its not writing anything to the console. 我一直在使用Sop来尝试调试一些代码,并且没有向控制台写入任何内容。 I thought that I just wasn't reaching the point in the code where I had it written, but I then added it to another piece of code where I knew for a fact was being executed. 我以为我只是没有达到编写代码的目的,但后来我将其添加到了我知道正在执行事实的另一段代码中。 I have it in here: 我在这里:

  public MainMenuUI(MainMenuCntl theCreatingCntl) {
    theCreatingCntl = theMainMenuCntl;
    System.out.println("MMUIConstructor");
    initComponents();
    this.pack();
    this.setVisible(true);
}

The MainMenuUI pops up as expected, but the sop does nothing. MainMenuUI会按预期方式弹出,但是sop不会执行任何操作。 Any help would be greatly appreciated. 任何帮助将不胜感激。

You need to run your program with the java command instead of javaw . 您需要使用java命令而不是javaw运行程序。 Here are the differences : 区别如下:

The java command starts a Java application. java命令启动Java应用程序。 It does this by starting a Java runtime environment, loading a specified class, and calling that class's main method. 它通过启动Java运行时环境,加载指定的类并调用该类的main方法来实现。

The javaw command is identical to java, except that with javaw there is no associated console window. javaw命令与java相同,除了javaw没有关联的控制台窗口。 Use javaw when you do not want a command prompt window to appear. 当您不希望显示命令提示符窗口时,请使用javaw。 The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason. 但是,如果由于某种原因启动失败,javaw启动器将显示一个带有错误信息的对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM