#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Java---Beginner in Despair---Help with "file.java.swp"?


    Hi there! Thanks for clicking on this thread!

    I am a beginner, a confused but eager one!

    I am using the Java language and trying to program for a simple single line of text.

    I turned on DOS and got to make a file (with a "vi thing" I downloaded with Cygwin) like this:

    C:\folder>vi Howdy.java

    I press enter and a blank space appears and I type EXACTLY like in the tutorial video:

    apublic class Howdy {
    public static void main(String Arg[]) {
    System.out.println("Howdy Y'all!);
    }
    }



    Then compile the program. I turned on another DOS, and got it to display my files and directories. In the tutorial video, the instructor's file appeared correctly as "Howdy.java", but mine appeared as "Howdy.java.swp".

    When I tried to use javac with it, DOS told me javac was not recognized as an internal or external command.

    I am very perplexed and deeply troubled! I've been trying to troubleshoot it all day long but couldn't get it.

    If anyone would shed some light at all, I would be tearfully thankful.
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    There are a couple of things you need to.

    First is to rename your file

    ren Howdy.java.swp Howdy.java

    Second, you need to add the bin directory of your JDK into your PATH.

    You can do this through the Control Panel. Click on System, and you'll see a link to Advanced System Settings.

    Make sure you restart your command prompt after you set the PATH.
  4. #3
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,696
    Rep Power
    347
    Also posted at http://www.javaprogrammingforums.com/java-theory-questions/31255-help-file-java-swp-please.html
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by Jean216

    Then compile the program. I turned on another DOS, and got it to display my files and directories. In the tutorial video, the instructor's file appeared correctly as "Howdy.java", but mine appeared as "Howdy.java.swp".
    You must have tried Ctrl+S to save the file in the vi mode. Usually it creates a file of a kind filename.ext.swp

    In this case if you try to vi to the file again you will face a warning kind of a thing which is more annoying.

    Since its a test file you are creating, quick fix for the same would be to delete the file and create a new one with the contents.

    To save the file in vi mode, click "Esc" followed by typing :wq and hit enter.

    That does it all.

    Originally Posted by Jean216
    When I tried to use javac with it, DOS told me javac was not recognized as an internal or external command.
    It seems you haven't set the path to the Java binary and hence you face the issue.

    This guide can probably help you to get started:
    docs.oracle.com/javase/tutorial/essential/environment/paths.html

    Cheers

IMN logo majestic logo threadwatch logo seochat tools logo