{"id":4973,"date":"2018-07-21T04:24:34","date_gmt":"2018-07-21T11:24:34","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=4973"},"modified":"2025-12-15T06:29:09","modified_gmt":"2025-12-15T14:29:09","slug":"see-java-console","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/see-java-console\/","title":{"rendered":"Q&#038;A: How can I see my Java Console Window when Running as a Service with AlwaysUp?"},"content":{"rendered":"<div align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/qa-show-java-console.png\" title=\"Q &#038; A - Show Java Console Window\" alt=\"Q &#038; A -Show Java Console Window\" border=\"0\" width=\"457\" height=\"154\"><\/div>\n<div class=\"blog-qa-question-box\">\n<img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"https:\/\/cdn.coretechnologies.com\/images\/quotes-transparent-21x21.webp\" width=\"21\" height=\"21\" \/>&nbsp;&nbsp;I am running a Java application as a windows service with AlwaysUp. My JAR starts up fine and seems to be working as expected but I can&#8217;t see the Java console window to make sure that there are no errors. How can I see the console window?<\/p>\n<p align=\"right\">&#8212; Alain Thir\u00e9, Thikro<\/p>\n<\/div>\n<p>Hi Alain. You cannot see your Java console window because it is running in a different <a href=\"https:\/\/blogs.technet.microsoft.com\/askperf\/2007\/07\/24\/sessions-desktops-and-windows-stations\/\" target=\"_blank\" rel=\"noopener noreferrer\">Windows &#8220;Session&#8221;<\/a>.<\/p>\n<p>Let me explain a bit about Sessions and how they work:<\/p>\n<ol>\n<li>\n<p>When you log into your PC, Windows creates a <b>Session<\/b> for you. That Session holds your desktop and all the programs you start. All your applications (processes) run inside that Session. <b>Think of the Session as your own private room, holding all your things.<\/b><\/p>\n<\/li>\n<li>\n<p>If your wife logs in, she receives her own Session to hold all the applications she uses. Her Session is completely separate from yours and any program she starts will only be visible to her on her desktop. <b>She gets her own private room.<\/b><\/p>\n<\/li>\n<li>\n<p>When your computer starts, windows creates a special Session for all services. That is, <b>Windows Services have their own room<\/b>. And because this is the first Session created, it is named <b>Session 0<\/b>.<\/p>\n<\/li>\n<\/ol>\n<p>\nNow when AlwaysUp starts your application as a Windows Service, it launches it in Session 0 (the home for all Windows Services). And because you are logged into a completely different Session (perhaps Session 1 or Session 2), you will not be able to see your application&#8217;s windows on your desktop. <b>Your Java application isn&#8217;t in your room.<\/b>\n<\/p>\n<p>But fortunately that is not the end of the story. Here are three ways to see what Java is printing to the console.<\/p>\n<hr class=\"blog-section\">\n<div style=\"width:100%;margin-bottom:30px;\">\n<div style=\"margin:0px;float:right;\"><a href=\"#top\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/top.jpg\" border=\"0\" width=\"50\" height=\"18\" title=\"Go to the top\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<h2 class=\"blog-caption\"><b>Solution #1: Temporarily Switch to Session 0<\/b><\/h2>\n<p>Windows gives you the opportunity to view the Session 0 desktop whenever a window is displayed there. Click <b>View the message<\/b> when the <a href=\"\/blog\/alwaysup\/prevent-interactive-services-detection\/\">Interactive Services Detection alert<\/a> pops up:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/interactive-services-detection-dialog.png\" class=\"zoomPopup\" title=\"Interactive Services Detection Dialog\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/interactive-services-detection-dialog.png\" width=\"462\" height=\"292\" title=\"Interactive Services Detection Dialog (click to enlarge)\" alt=\"Interactive Services Detection Dialog\" border=\"0\" ><\/a><\/div>\n<p>AlwaysUp allows you to access Session 0 at any time. Simply select <nobr><b>Tools &gt; Switch to Session 0<\/b><\/nobr> from the menu:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/alwaysup-switch-to-session-0-menu.png\" class=\"zoomPopup\" title=\"Switch to Session 0 from the Menu\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/alwaysup-switch-to-session-0-menu.png\" title=\"Switch to Session 0 from the Menu (click to enlarge)\" alt=\"Switch to Session 0 from the Menu\" border=\"0\" width=\"520\" ><\/a><\/div>\n<p>Or click the &#8220;monitor&#8221; button on the toolbar to do the same:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/alwaysup-switch-to-session-0-toolbar.png\" class=\"zoomPopup\" title=\"Switch to Session 0 from the Toolbar\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/alwaysup-switch-to-session-0-toolbar.png\" title=\"Switch to Session 0 from the Toolbar (click to enlarge)\" alt=\"Switch to Session 0 from the Toolbar\" border=\"0\" width=\"520\" ><\/a><\/div>\n<p>Now be warned &mdash; Session 0 is a strange looking place! You won&#8217;t see a task bar, desktop icons or the familiar start button. Here is what the austere Session 0 looks like with Notepad running:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/session-0-with-notepad.png\" class=\"zoomPopup\" title=\"Session 0 with Notepad Running\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/session-0-with-notepad.png\" title=\"Session 0 with Notepad Running (click to enlarge)\" alt=\"Session 0 with Notepad Running\" border=\"0\" width=\"520\" ><\/a><\/div>\n<p>Click <b>Return now<\/b> to revert to the safety of your normal desktop.<\/p>\n<div class=\"highlight-box-pink\">\nNote: Switching to Session 0 may not be a viable option on Windows 10 and Windows Server 2016 because you will be <a href=\"\/products\/AlwaysUp\/AlwaysUp_FAQ.html#Session0NoKeyboardMouse\">unable to use the keyboard and mouse in Session 0<\/a>. Unfortunately there is no workaround and we cannot confirm if\/when Microsoft will address this annoying problem.\n<\/div>\n<hr class=\"blog-section\">\n<div style=\"width:100%;margin-bottom:30px;\">\n<div style=\"margin:0px;float:right;\"><a href=\"#top\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/top.jpg\" border=\"0\" width=\"50\" height=\"18\" title=\"Go to the top\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<h2 class=\"blog-caption\"><b>Solution #2: Restart your Java application in your Session<\/b><\/h2>\n<p>A second way to view the Java window is to have AlwaysUp restart your Java application in your login session. Select <b>Application &gt; Restart in this session<\/b> to have the console appear on your desktop, alongside your other windows:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/restart-application-in-this-session.png\" class=\"zoomPopup\" title=\"Restart in this session\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/restart-application-in-this-session.png\" title=\"Restart in this session (click to enlarge)\" alt=\"Restart in this session\" border=\"0\" width=\"520\" ><\/a><\/div>\n<p>AlwaysUp will automatically return your application to Session 0 after you log off (or you can return it manually).<\/p>\n<p>The obvious downside of this approach is that your application has to be stopped. <b>Might a brief interruption cause problems?<\/b> If so, restarting in your session may not be the solution for you.<\/p>\n<hr class=\"blog-section\">\n<div style=\"width:100%;margin-bottom:30px;\">\n<div style=\"margin:0px;float:right;\"><a href=\"#top\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/top.jpg\" border=\"0\" width=\"50\" height=\"18\" title=\"Go to the top\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<h2 class=\"blog-caption\"><b>Solution #3: Capture the Java console output to a file<\/b><\/h2>\n<p>The final solution reframes the problem. Instead of seeing the Java console window, is viewing the text printed in the window good enough?<\/p>\n<p>If so, setup AlwaysUp to capture the console output to a text file. Activate the option and specify the full path to the log file on the Extras tab:<\/p>\n<div align=\"center\"><a href=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/capture-java-console-output.png\" class=\"zoomPopup\" title=\"Capture Java console output\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"https:\/\/cdn.coretechnologies.com\/blog\/images\/capture-java-console-output.png\" title=\"Capture Java console output (click to enlarge)\" alt=\"Capture Java console output\" border=\"0\" ><\/a><\/div>\n<p>Simply open the text file to see what Java has printed to the console. Or even better, use a free &#8220;tail&#8221; utility to follow the file&#8217;s additions in real time. Both <a href=\"https:\/\/blogs.technet.microsoft.com\/rmilne\/2016\/06\/03\/powershell-tail-command\/\" target=\"_blank\" rel=\"noopener noreferrer\">Powershell&#8217;s Get-Content cmdlet<\/a> and <a href=\"http:\/\/tailforwin32.sourceforge.net\/\" target=\"_blank\" rel=\"noopener noreferrer\">Tail for Win32<\/a> have worked well for our team.<\/p>\n<p>Best of luck with your Java application\/service!<\/p>\n<div style=\"margin-top:30px\" align=\"center\">\n<div class=\"cta-button-1\">\n<table role=\"presentation\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"left\">\n<tbody>\n<tr>\n<td align=\"center\"><a href=\"\/blog\/tag\/alwaysup-tag\/\" title=\"Click to read more articles about AlwaysUp\"><span><nobr>More articles about AlwaysUp&#8230;<\/nobr><\/span><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/version-15-5-released\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"AlwaysUp 15.5: Advanced Support for PowerShell, OneDrive, and more\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/new-update-150x150-2.webp\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">AlwaysUp 15.5: Advanced Support for PowerShell, OneDrive, and more<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/google-drive-updates\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: How do I get AlwaysUp to Run the Latest Google Drive for desktop?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/google-drive-150x150-1.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: How do I get AlwaysUp to Run the Latest Google Drive for desktop?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/version-13-3-released\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"AlwaysUp 13.3 Introduces Log File Rollover and Expands the use of Variables\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/available-now-150x150-1.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">AlwaysUp 13.3 Introduces Log File Rollover and Expands the use of Variables<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;I am running a Java application as a windows service with AlwaysUp. My JAR starts up fine and seems to be working as expected but I can&#8217;t see the Java console window to make sure that there are no errors. &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/see-java-console\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3560,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[26,94,127,153,162,196],"class_list":["post-4973","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alwaysup","tag-alwaysup-tag","tag-java","tag-qa","tag-session-0-isolation","tag-switch-to-session-0-2","tag-windows-services-2"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=4973"}],"version-history":[{"count":2,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4973\/revisions"}],"predecessor-version":[{"id":13282,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/4973\/revisions\/13282"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/3560"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=4973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=4973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=4973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}