Can I talk Java into printing to the console under Mountain Lion?
Asked Answered
W

2

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?

Weever answered 7/10, 2012 at 12:10 Comment(5)
Did you try the "hello world" test described in the linked thread?Scharf
Does java -version produce any output to the console?Scharf
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.Weever
By "the console" you mean Console.app, right? If so, I should mark this for deletion (duplicate): #15440129Gottlieb
Yes, I do mean the Console.app, so feel free to mark this question as a duplicate.Weever
T
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?

Teleology answered 4/11, 2012 at 10:27 Comment(0)
L
0

Does this work?

System.console().printf("Hello World!");
Lalalalage answered 31/10, 2012 at 13:24 Comment(1)
Why the downvote? It's a perfectly fair question. Notice that RampantBadger's answer came 4 days later.Lalalalage

© 2022 - 2024 — McMap. All rights reserved.