Thread: Compile Error

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

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2

    Compile Error


    I want to compile my java file can you help me correct my java so I can compile.


    Invalid escape error when and also the name in the directory is invalid. I was able to compile a HelloworldApp.java with no problem. I changed the file extensions for my .java to open notepad. Is this a problem?


    javac: file not found: NumberGuess2.java
    Usage: javac <options> source files>
    use -help for a list of possible options
    Last edited by Bykenhaal; December 13th, 2013 at 07:23 PM.
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    Copy the full text of the error messages you are getting and paste them here.
  4. #3
  5. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    Originally Posted by Bykenhaal
    I changed the file extensions for my .java to open notepad. Is this a problem?


    javac: file not found: NumberGuess2.java
    What does the error say? Does the file NumberGuess2.java exist? Are you sure it's not named NumberGuess2.java.txt?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    I am sure it is RandomGuess2.java I am really have trouble to compile any of my work. I will try what you said about .java.txt
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    C:\Users\Richard\Documents\NetBeansProjects\NumberGuess2.java> javac NumberGuess2.java

    javac: file not found: NumberGuess2.java
    Usage: javac <options> <source files>
    use -help for a list of possible options

    Should I have to open the src file to compile?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    I went to where I can open my java file in NetBeansProjects.
    I tried both of these also still not working. I have been looking into finding the file I thought it was th folder i must be mistaken.
    I was able to compile before but I saved the .java file to my desktop this cut out all the extra folders.

    C:\Users\Richard\Documents\NetBeansProjects\NumberGuess2.java\src\numberguess2>javac numberguess2.java

    C:\Users\Richard\Documents\NetBeansProjects\NumberGuess2.java\src\numberguess2>javac NumberGuess2.java
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    directory is invalid when I made a copy and put the java file on my desktop and in properties it said it is located on the desktop.


    I am at a lost I really am have major trouble and I do not know what is wrong I have watch training videos and I do what they do and still I have not been able to compile my project.

    Please help.
  14. #8
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,724
    Rep Power
    348
    Open a command prompt window
    change directory to the directory with the .java file (using cd command)
    Enter this command: dir *.java
    Look at what is printed and see that the .java file is there
    Enter this command: javac XXXXXX.java
    replacing the XXXXXX with the name of the .java file

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    59
    Rep Power
    2
    I thank you it looks like I have got a .class file now. It looks like the compiled version of my .java program.

    I can't believe it because it was giving me so much trouble and after I could not find the .class like the video showed. It was in NetBeans in the folder as the name name as the program under src and then a few more clicks under a directory name Build my I found the .class and .java

    So the new NetBeans Puts the .class files in the look like this on my computer the default settings.

    C:\Users\Richard\Documents\NetBeansProjects\NumberGuess2.java\src\build\classes

    Thanks
    Last edited by Bykenhaal; December 13th, 2013 at 06:54 PM.

IMN logo majestic logo threadwatch logo seochat tools logo