Results 1 to 5 of 5

Thread: Javac Problems

  1. #1
    franzwarning is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Smile Javac Problems

    Alright so I've installed the JDK (1.6.0_22 to be exact) and I'm running windows 7. I've typed in to my command prompt
    Java Code:
    javac -version
    and I get the version of the JDK so that works. But when I try compiling a example.java file it says
    Java Code:
    file not found
    . I've gone into the environment variables and added a variable name "path" with a variable value of "jdk....\bin
    ".

    What should I do from here to get it to work?

    Cheers,
    George

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    So we can see what's going on, copy and post the entire output from:

    Java Code:
    > dir
    > javac -version
    > javac example.java

    "dir" is to check that example.java really does exist and is in the right place. You do have to run javac.exe from the right place so that it "sees" example.java.

  3. #3
    franzwarning is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\George Kennedy>dir
    Volume in drive C is Windows
    Volume Serial Number is 3C2C-AC2E

    Directory of C:\Users\George Kennedy

    10/27/2010 08:15 PM <DIR> .
    10/27/2010 08:15 PM <DIR> ..
    10/17/2010 02:46 PM 145 .appletviewer
    10/10/2010 07:39 PM <DIR> bluej
    10/03/2010 11:07 AM <DIR> Contacts
    10/27/2010 08:59 PM <DIR> Desktop
    10/18/2010 11:18 PM <DIR> Documents
    10/26/2010 11:40 PM <DIR> Downloads
    10/03/2010 11:07 AM <DIR> Favorites
    10/03/2010 11:07 AM <DIR> Links
    10/03/2010 11:07 AM <DIR> Music
    10/17/2010 02:19 PM <DIR> myfolder
    10/03/2010 11:07 AM <DIR> Pictures
    10/03/2010 11:07 AM <DIR> Saved Games
    10/03/2010 11:07 AM <DIR> Searches
    10/18/2010 11:33 PM <DIR> Videos
    10/03/2010 11:07 AM <DIR> Virtual Machines
    10/17/2010 02:43 PM <DIR> Week 02
    1 File(s) 145 bytes
    17 Dir(s) 449,938,161,664 bytes free

    C:\Users\George Kennedy>javac -version
    javac 1.6.0_22

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

    C:\Users\George Kennedy>

  4. #4
    franzwarning is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    Thanks it worked i realized what i did

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    OK, so that explains the OS message: there is no HelloWorld1.java in the "C:\Users\George Kennedy" folder.

    Navigate to the folder that contains the java file and try the javac command again.

    [Edit]

    Great! I'm glad you've got the compiler working. Now all you have to do is figure out the innumerable compiler messages that it will deliver you ;)

Similar Threads

  1. Problems with javac
    By gkoef in forum New To Java
    Replies: 14
    Last Post: 09-07-2010, 10:17 AM
  2. javac
    By PhilArmstrong in forum New To Java
    Replies: 31
    Last Post: 11-21-2009, 03:46 PM
  3. javac?
    By sardare in forum Eclipse
    Replies: 1
    Last Post: 06-14-2008, 02:06 AM
  4. javac DOS
    By rdunne in forum New To Java
    Replies: 3
    Last Post: 01-01-2008, 11:49 AM
  5. Help with javaC
    By Daniel in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 02:44 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
  •