Reputation: 61
This has to be an easy question but can't seem to figure it out. In Netbeans and in Eclipse I have successful builds but no output. I'm thinking that there is something wrong with my JDK (possibly??) I can't post a screen shot:( so I'll include the code.
package hiall;
public class HiAll {
public static void main(String[] args) {
System.out.println("HiAll");
}
}
Can't get any simpler!!!
In HiAll(run) window
run: BUILD SUCCESSFUL (total time: 0 seconds)
Before I remove all java components and starting again does anyone have suggestions????
Upvotes: 3
Views: 26735
Reputation: 51
I used to experience the same problem, I solved it using Shift + F11 and then run F6.
Upvotes: 1
Reputation: 41
I had this exact problem in NetBeans (11.1) and the solution for me was to Clean+Build the project (Shift + F11). After that, running the project with F6 printed the expected output.
Upvotes: 4
Reputation: 1
Make sure you go to 'Run' - 'Set main project' - 'none'. Worked for me when i had the same problem.
Upvotes: 0
Reputation: 3
In the Projects panel on Netbeans (which should be the top left panel), right click on the class you're running and then press "run file". You can open the output window by opening Windows -> Output
Upvotes: 0
Reputation: 1216
Before remove anything, I'd try:
Upvotes: 0
Reputation: 5324
In Netbeans there should be a so called "Output" Window in the down-right corner of your screen, which should show the console output (System.out.println("");
).
Logically this does only occur, when you run the .jar-file by pressing "Run" (F6) (which is different from compiling or building [F11]).
If the console output is not visible, you can right click on the running process and select "Show Output"
Upvotes: 0
Reputation: 644
It outputs in your IDE's console, you won't see anything outside Eclipse Look for the 'console' tab. In Eclipse it's in the bottom part of the screen (when you have default settings) . I don't know about NetBeans but should be similar.
If you expect a screen to pop-up and show you this text you could do this:
package hiall;
public class HiAll {
public static void main(String[] args) {
JFrame f=new JFrame();
JLabel label=new JLabel("HiAll");
f.add(label, BorderLayout.CENTER);
f.setVisible(true);
f.setSize(400,400);
}
}
Upvotes: -1