开发者

System.out.println doesn't work?

开发者 https://www.devze.com 2023-04-10 04:06 出处:网络
When I write this in the main method: System.out.println(\"Hello\"); Nothing is outputted on the output console. It just says \"Build successful (total time: 0 seconds)\". What\'s the problem?

When I write this in the main method:

System.out.println("Hello");

Nothing is outputted on the output console. It just says "Build successful (total time: 0 seconds)". What's the problem?

Here is my full program:

package names;

  public class myName {

  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      // TODO code application logic here
      System.out.println("test");

  }
}

Here's the window after I debug the program:

Have no file for /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar
Have no file for /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar
Have no开发者_如何学Python file for /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar
BUILD SUCCESSFUL (total time: 1 second)


On netbeans right click and click run file. It would run. Seems like you're building the project, and not executing it. Don't debug it. Run it.

System.out.println doesn't work?


I'm nearly sure it's due to an IDE issue: the ant/build output is being redirected to a different place (not stdout) and you're seeing that "other place" as a "Console". Please let us know your IDE and as much code as you can.


You have to run it then. In netbeans, to run you can press F6 - http://netbeans.org/kb/docs/java/quickstart.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号