Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java in Windows 10 command line

  1. #1
    Junior Member
    Join Date
    Oct 2024
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java in Windows 10 command line

    I have installed a folder jdk-23.0.1 on Windows 10 and added c:\jdk-23.0.1\bin to the "path" environment variable. I have set various items to "Run as Administrator" to clear those hurdles.
    I believe I have got as far as being able to run Java from the command line but am not sure as the console closes about 0.1 seconds after opening. There are many recipes on line for this but I have not found one that did not evoke a shower of error messages. I have tried to compile a "Hello world" program and run it but again cannot see the output if any. I have tried many guesses and online recipes but Java seems impregnable. Is there anything online for beginners? Searches have not revealed anything I can understand or that was correct.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Java in Windows 10 command line

    I do not understand. What are the steps you are doing for the test?
    Here is what I do:
    1 - open command prompt window
    2 - change directory to the location of the java file
    3 - enter the command: javac MyProgram.java
    If no errors displayed, then
    4 - enter the command: java MyProgram
    The command prompt window should remain open through all of the above.

    Is this what you are doing? If not please explain.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. java question on command line
    By SuhasChaugule in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 3rd, 2014, 08:44 AM
  2. Replies: 12
    Last Post: August 2nd, 2012, 10:13 PM
  3. employing library jar from windows command line
    By meathead in forum Other Programming Languages
    Replies: 6
    Last Post: December 12th, 2011, 04:49 PM
  4. Replies: 10
    Last Post: September 16th, 2011, 07:49 PM
  5. Run command line structure in Java
    By soheilz92 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: April 20th, 2011, 02:26 AM