Question

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 file for /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar
BUILD SUCCESSFUL (total time: 1 second)
Was it helpful?

Solution

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.

enter image description here

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top