Results 1 to 3 of 3
  1. #1
    Ashe Firefly is offline Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Default javac: file not found

    Hi. So I'm pretty new to using Java, and I just installed version 7 update 40 on my computer, it's a Toshiba laptop running on Windows 8. I've used Java on the desktops at school and my program works fine there, so after I downloaded and installed Java and added it to my path (;C:\Program Files (x86)\Java\jdk1.7.0_40\bin I just rewrote the same program, saved it as a .java file, and then tried to compile it. My file's named 'Lesson1v0_ThuotteEmily.java' and so I put in 'javac Lesson1v0_ThuotteEmily.java' the same as I would in school, only instead of compiling it, it came up with the message:
    'javac: file not found: Lesson1v0_ThuotteEmily.java
    usage: javac <options> <source files>
    use -help for a list of possible options'
    I'm not sure what's going on or why it's not working. Did I not put in the right thing to make my file compile, did I name the file wrong...? Oh, and I put my command for compiling the file into 'C:\Users\Emi>' but I've also tried just using 'C:\' and using 'C:\Program Files' and lots of other ones, and it just gives the same message. It also refuses to open the directory of the file my program is in, if I put in 'cd\Computer Programming' (the Documents file I saved my .java to) it says the system cannot find the path specified. At my school, cd\Java Programs will open the documents file I've saved my .java programs into, so I don't know if my computer should be able to open the file or not, but I thought it worth mentioning.
    I don't have a Classpath thing, and I'm pretty sure it should be working because when I put in 'javac' in the cmd window, a list of commands comes up like it's supposed to, and if I say 'where java' it gives me the right location within the computer. I'm not sure if maybe I need to add it to the PSModulePath or something?
    And just to make sure I wrote my code right:
    public class Lesson1v0_ThuotteEmily
    {
    public static main void(String args[])
    {
    System.out.println("It works!");
    }
    }

    That's it.
    Please, if someone could help me with this issue and explain to me why it's happening and how to fix it, I'd be very grateful and I really need the help. I asked my teacher, but he couldn't come up with anything helpful, and I've gone through as many threads as I can find under this problem and I can't find anything to help me. I've tried getting it to compile by adding slashes and C:\ before it like I've seen other people do, but no matter what I try, it just tells me the file can't be found. I thought it might be that I saved them in different places and that was the problem, but the Java at school is under Program Files and my .java programs are under Documents and it will still compile them there, so I'm not sure if that's got anything to do with it or not...
    Anyway, help is very much appreciated, please!

  2. #2
    Ashe Firefly is offline Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Default Re: javac: file not found

    Bump. Anyone? Help, please?

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: javac: file not found

    a) use simpler classnames so you its harder to make typo mistakes (but you can use the tab key to autocomplete in the command prompt)
    b) you need to invoke javac in the actual directory where the java source file exists, since you're using a relative path
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. javac: file not found:
    By jayshree in forum New To Java
    Replies: 1
    Last Post: 03-14-2012, 06:43 PM
  2. javac: file not found:
    By Tastosis in forum New To Java
    Replies: 6
    Last Post: 03-24-2011, 05:35 AM
  3. Javac, file not found
    By Zorobay in forum New To Java
    Replies: 1
    Last Post: 02-15-2010, 11:30 AM
  4. javac:file not found
    By lovearora in forum New To Java
    Replies: 3
    Last Post: 02-09-2009, 03:20 AM
  5. javac file not found
    By teamkeff in forum New To Java
    Replies: 6
    Last Post: 06-23-2008, 10:17 PM

Tags for this Thread

Posting Permissions

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