This discussion is archived
13 Replies Latest reply: Jul 9, 2007 7:53 AM by 807600 RSS

Javac can't find my file...

807600 Newbie
Currently Being Moderated
I have put javac into my PATH so now it recognizes javac but now it can't find my HelloWorld.java that is on my desktop.


Is a certain folder I need to put my source in?

Thanks for any help.

Also, if it matter I have XP sp2
  • 1. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Well, where are you compiling from? It won't magically scan your entire hard drive looking for a file
  • 2. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    My file is on my desktop so where should put it?
  • 3. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Should I put it in /bin with the javac file?
  • 4. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Wherever you want, theoretically. Probably a good idea to get into the habit of keeping source code at least somewhere vaguely sensible. Just sticking them on your desktop is a bad idea. But the crux of the matter is, you need to invoke the javac compiler either from the folder the source code is in, or by specifying a path to the source code. Read the basics tutorial for more. The forum may be "new to Java" but it isn't intended as a replacement for reading a tutorial, more to help you when you don't understand something
  • 5. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Should I put it in /bin with the javac file?
    No! Do yourself a favour. Put the compiler down for now, and do some reading
  • 6. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Ok you tell me to read and I look around but where are the tutorials???
  • 7. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Ok you tell me to read and I look around but where
    are the tutorials???
    You found this place, didn't you? If only you could apply what you did to find this, to something else......
  • 8. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Ok I found the tutorial I did a cd command in the directory I have my source in then I do "javac helloworld.java" and I get and error saying "error: Class names, 'helloworld',are only excepted if annotation processing is explicitly requested."
  • 9. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Sorry, I know this sounds harsh, but I'm not getting into holding your hand through what you should find out for yourself. If I do, you'll be reliant on someone helping you with everything else, and never get anywhere. Trust me, go read a tutorial. All of it. From start to finish. You've probably just scanned it for certain key words like "compile"
  • 10. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Hey nice guy I did it myself!!!!!!!!!!!!!!!!!!!
  • 11. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    Told you so
  • 12. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    just do one thing...
    Right click on your My Computer icon on the Desktop.
    Click on properties button.
    Click on advanced tab.
    Click on Environment variable button.
    In system variables list select the path variable.
    Click on edit button.
    Do not change the previous path.
    Just append semicolon " ; " if the previous path doesen't ends with it.
    Now append absolute path of your java bin directory which must be like
    C:\j2sdk1.4.0\bin; there.
    Click OK button
    Do it 2 times more for closing all the dialog boxes.
    Now you can keep your files anywhere in your file system.
    To run them just go into that directory.
    Suppose you have kept them in C:\abc\xyz folder
    then cd c:\abc\xyz
    and then run java file as

    javac filename.java

    java filename

    Thats all.
    i am sure that it must work.
  • 13. Re: Javac can't find my file...
    807600 Newbie
    Currently Being Moderated
    just do one thing...
    Right click on your My Computer icon on the Desktop.
    Click on properties button.
    Click on advanced tab.
    Click on Environment variable button.
    In system variables list select the path variable.
    Click on edit button.
    Do not change the previous path.
    Just append semicolon " ; " if the previous path
    doesen't ends with it.
    Now append absolute path of your java bin directory
    which must be like
    C:\j2sdk1.4.0\bin; there.
    Click OK button
    Do it 2 times more for closing all the dialog boxes.
    Now you can keep your files anywhere in your file
    system.
    To run them just go into that directory.
    Suppose you have kept them in C:\abc\xyz folder
    then cd c:\abc\xyz
    and then run java file as

    javac filename.java

    java filename

    Thats all.
    i am sure that it must work.
    That's considerably more than one thing