Results 1 to 5 of 5
  1. #1
    jok7er is offline Member
    Join Date
    Feb 2017
    Posts
    4
    Rep Power
    0

    Default Hello World opens a notepad document?

    I'm not sure what I'm doing wrong but I've been attempting to print "Hello World!" and have come across and issue. When I enter the command prompt and locate the file I want and enter it, a notepad document is opened. I'm using notepad++ to save my code and I've been using the save as, but I'm not sure how to save it another way or what I'm doing wrong. I think my issue is due to the fact that I'm saving it as a document but I'm not sure why it would open notepad (as I'm using notepad ++) and why the save as function would do this....

    If there's any sort of lack of clarity I'd be happy to try and explain better!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Hello World opens a notepad document?

    When I enter the command prompt and locate the file I want and enter it, a notepad document is opened.
    What command do you enter in the command prompt window?
    What do you mean by: "enter it"?
    What is the name of the file that you locate?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jok7er is offline Member
    Join Date
    Feb 2017
    Posts
    4
    Rep Power
    0

    Default Re: Hello World opens a notepad document?

    Oops, I left out a pretty critical part.

    The file is Hello.java
    I type "javac Hello.java", then press enter. Then I type "Hello.java".

    I think my issue might be with where the file is located, since it is located inside the Documents folder.
    I've copied the process I go through in my cmd below.

    C:\Users\jok7er>javac Hello.java
    javac: file not found: Hello.java
    Usage: javac <options> <source files>
    use -help for a list of possible options

    C:\Users\jok7er>cd Documents

    C:\Users\jok7er\Documents>javac Hello.java

    C:\Users\jok7er\Documents>Hello.java

    //this opens a notepad document

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Hello World opens a notepad document?

    Your OS must associate .java files with the Notepad application. When you click on a .java file or enter its name in a command prompt, the notepad program is called to open it.

    If the javac command successfully complies the .java file, it creates a .class file. Check that there is a Hello.class file.
    To execute the class file enter:
    java Hello
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    jok7er is offline Member
    Join Date
    Feb 2017
    Posts
    4
    Rep Power
    0

    Default Re: Hello World opens a notepad document?

    There is a class file and the command executed when I entered "java Hello"

    Thank you!

Similar Threads

  1. Replies: 0
    Last Post: 08-29-2012, 08:26 AM
  2. JFormattedTextField, Document Filter, Document Listener
    By D.Calladine in forum AWT / Swing
    Replies: 1
    Last Post: 03-21-2012, 11:48 PM
  3. Java world generator-real world with people and stuff
    By conker5295 in forum Jobs Offered
    Replies: 2
    Last Post: 02-23-2012, 01:22 PM
  4. A menuItem that opens a TableInput Form
    By jam123 in forum AWT / Swing
    Replies: 1
    Last Post: 01-12-2012, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •