7

I'm using the good old System.out.println - approach to debug my Java application. Before I upgraded to Mac OS 10.8 this worked wonderfully. Now however my console wouldn't display anything. Apparently I'm not the first one to encounter this behavior - see http://www.mac-forums.com/forums/os-x-operating-system/280577-system-out-println-not-showing-console.html.

Does any of you guys know a way?

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Maximilian Tyrtania
  • 437
  • 1
  • 4
  • 14
  • Did you try the "hello world" test described in the linked thread? – Stephen C Oct 07 '12 at 13:13
  • Does `java -version` produce any output to the console? – Stephen C Oct 07 '12 at 14:56
  • Actually, no, it doesn't! It does in the terminal, but not in the console (not sure I would expect it to, though). Thought you wondered if java is installed at all. The java project is fairly large und runs as expected, it's just that I can't debug it the way I could under 10.7. – Maximilian Tyrtania Oct 07 '12 at 15:08
  • By "the console" you mean Console.app, right? If so, I should mark this for deletion (duplicate): http://stackoverflow.com/questions/15439629/how-do-i-enable-java-output-in-console-app-in-osx-10-8-3 – ericsoco Oct 01 '13 at 18:57
  • Yes, I do mean the Console.app, so feel free to mark this question as a duplicate. – Maximilian Tyrtania May 05 '14 at 13:07

2 Answers2

2

System.console() returns null for me with mountain lion and java 6.

We have had to change our logging in our app to use log4j to output to stdout (which used to go to system.log prior to 10.8) AND produce our own log files in ~/Library/Logs which can be seen in console.app under any version.

Doesn't appear to be a sandboxing issue as i'm not seeing any sandboxing errors. Prob more investigation needed to see what device is being handed to the jvm under 10.8. At a guess maybe its being handed /dev/null for logging by mistake?

dnlcrl
  • 5,022
  • 3
  • 32
  • 40
0

Does this work?

System.console().printf("Hello World!");
Stewart
  • 17,616
  • 8
  • 52
  • 80
  • Why the downvote? It's a perfectly fair question. Notice that RampantBadger's answer came 4 days later. – Stewart Nov 21 '12 at 01:15