Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:32:08+00:00 2026-06-14T10:32:08+00:00

Possible Duplicate: System.Console() returns null Code: public class Demo { public static void main(String[]

  • 0

Possible Duplicate:
System.Console() returns null

Code:

public class Demo {

public static void main(String[] args){
    Console c = System.console();
    if (c == null) {
        System.err.println("No console.");
        System.exit(1);
    }else {
        System.out.println("Console is.");
        System.exit(0);
    }
}

}

always No console. Why ? How to fix? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:32:10+00:00Added an answer on June 14, 2026 at 10:32 am

    You don’t have any console associated.

    As per javadoc

    Returns the unique Console object associated with the current Java
    virtual machine, if any, otherwise null

    EDIT:

    From Console javadoc.

    Whether a virtual machine has a console is dependent upon the underlying platform and also upon the manner in which the virtual machine is invoked. If the virtual machine is started from an interactive command line without redirecting the standard input and output streams then its console will exist and will typically be connected to the keyboard and display from which the virtual machine was launched. If the virtual machine is started automatically, for example by a background job scheduler, then it will typically not have a console.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: class System.Random .. why not static? Following on from Generated random numbers
Possible Duplicate: Why might a System.String object not cache its hash code? I always
Possible Duplicate: Difference between string and StringBuilder in c# What’s the difference between System.String
Possible Duplicate: Locking main() thread Below you'll find my code, Main calls two threads,
Possible Duplicate: What is System.Void? Why not System.Void? I noticed that it is not
Possible Duplicate: What is System.Void? I have no practical reason for knowing this answer,
Possible Duplicate: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).System.Data while data adapter Fill() Below is the code
Possible Duplicate: How to convert System.Decimal bits to string in C#? I get int[]
Possible Duplicate: Printing message on Console without using main() method Can someone suggest how
Possible Duplicate: Hide console in C system() function, Win. Hi guys I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.