1

I'm still new to Java and so I'm not understanding where the termination error is coming from. The System.out.println in the main is not being printed out and it says:

< terminated, exit value: 0> C:\Program Files\Java\jre1.8.0_71\bin\javaw.exe (Jan 27, 2016, 1:22:17 PM)

Here is the main of my code.

public class BrainCenter {
    public static void main(String[] args) {
          System.out.println("Welcome to the Stock Center!");
          System.out.println("Realtime Reports within the stock market");
          System.out.println("");

          Market mk = new Market(6000);
          mk.printMarket(); 

          System.out.println("Individual status listed below");
          System.out.println("");

          Buyers bu = new Buyers();
          bu.buildRandomPortfolio(mk);
    }
}

The first three lines are not being outputted and I'm not sure why. It appears as the rest of the code loads but then disappear and said to be terminated at the end. I'm using Eclipse IDE. Any help would be greatly appreciated. Thank you in advance!

prongsm
  • 11
  • 3
  • 2
    That actually isn't a termination error code. "terminated, exit value: 0" just means the program ran and completed as expected. Now as to why it didn't print the lines...I can't figure that one out. Your syntax looks good! I'm wondering it it's something outside of your code. What ide are you using? – Ageonix Jan 27 '16 at 21:49
  • what IDE are you using if any? how did you run it? (cmd or the ide) –  Jan 27 '16 at 22:09
  • Maybe your program is executing another `main` which is declared elsewhere. Or you're redirecting your output. – Bifz Jan 27 '16 at 22:16
  • Possible duplicate of [Difference between java.exe and javaw.exe](http://stackoverflow.com/questions/1997718/difference-between-java-exe-and-javaw-exe) – Whymarrh Jan 27 '16 at 22:43
  • Are you sure you are running `BrainCenter.main` and not something else? – OneCricketeer Jan 27 '16 at 23:34
  • That error format looks like Eclipse; if so are you looking at the Debug pane and not the Console pane (where child standard input and output go)? – dave_thompson_085 Jan 27 '16 at 23:45

2 Answers2

0

Try to use java.exe instead of javaw.exe. The first will wait until the program completes. It will also put all output the program generates directly in console. The last should be used when the program runs with its own GUI or simply in background. It will not wait until the program completes.

See Difference between java.exe and javaw.exe.

Community
  • 1
  • 1
kalaider
  • 193
  • 10
0

you can fix this problem by setting path variable in Environment. In my system I have copied path of bin as "C:\Program Files\Java\jdk1.8.0_25\bin" and saved.