• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Help Please error: file not found

 
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Downloaded Version java 12.0.2 (includes jre from what I understand)
      Windows 64bit

created PATH
        both java -version and javac -version return correct versions

using notepad++
        saved file as .java (checked properties to ensure that no .txt had been appended)
        when saving file originally used the *all types
        tried saving file as *java (after completely deleting then saving app again as new type)


javac MyApp1.java
error: file not found: MyApp1.java.

I've been at this for a while now.

 
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the directory structure of your project? Can you cut-n-past the screen text from where you are getting this error?
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming you entered javac from the command line; what directory were you in at the time?
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the file name end in a period like this message shows?
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming I entered it from the command line as well. I open command prompt  C:\user\name>javac MyApp.java.

The project is a simple "Hello world" string to print.
public class MyApp {
    public static void main (String[] args) {
          System.out.print("MyApp");
    }
}

I'm not really sure what you mean by what directory. I'll research it while waiting for a reply. I can't cut and paste because the error is on command prompt.

c:\Users\myname>javac MyApp.java
error: file not found: MyApp.java
Usage: javac <options> <source files>
use --help for a list of possible option



I'm really sorry I'm new to this with only a little experience with c# in visual studio. Just started the HF java book before i start class in september.
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nope there isn't a period at the end of the error.
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, you entered this:
c:\Users\myname>javac MyApp.java

It is unusual to have anything directly in the user's directory. Usually you have a directory under "Documents", and probably a project directory under that. But let's assume you did put it in your user directory.

Assuming that your command line prompt says
C:\Users\myname>
Enter the "dir" command. It should look like this
C:\Users\myname>dir

you should see "MyApp.java" appear in the list, correct? Make sure the name is exactly like this with upper and lower case.
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you are using a Windows command window by running "cmd.exe", there is a way to capture text from the screen. Right click on the window header bar and select "mark". Then drag your mouse over some text, then press the Enter key. The text should now be on the clipboard and can be pasted with Ctrl+v.
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that's what I entered but its been saving to documents in my Onedrive.

I just moved it to C:\Users\jessg\Documents for testing this.

The Command line prompt has always said C:\Users\myname> so i just assumed that was usual.

after entering dir i see lots of dates and times as well as <DIR> and things like contacts, documents(which is the file i moved the program to), downloads, etc. but no "MyApp.java".

It's exactly the same and after moving the file and testing still getting the same "file not found"


 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally the prompt changes depending on what directory you are currently running from. So, if you moved your java file to: C:\Users\jessg\Documents then you want your command line prompt to read:
C:\Users\jessg\Documents>

If it only shows
C:\Users\jessg>
then you need to change directory. To do this you use the change directory command: "cd". As in
C:\Users\jessg>cd Documents

then the prompt should change to
C:\Users\jessg\Documents>

Now type the "dir" command again and look for MyApp.java.
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whew. Awesome. We're getting somewhere. It's the third one down  ., .. , MyApp.java.
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So now when I

C:\Users\jessg\Documents>javac MyApp.java

it returns

C:\Users\jessg\Documents>
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to consider having the following directories
C:\Users\jessg\Documents\Java\MyApp\
and putting your MyApp.java file in there. Of course you'll then need to "cd" to that directory in order to compile or run it.
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jesse Galloway wrote:Okay. So now when I

C:\Users\jessg\Documents>javac MyApp.java

it returns

C:\Users\jessg\Documents>


Sounds like it compiled. If you do another "dir" do you see "MyApp.class" ?
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup
 
Jesse Galloway
Greenhorn
Posts: 8
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't express how happy I am to see "Please Work" show up on the command prompt. lol Thank you so much!!!
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Carey Brown
Saloon Keeper
Posts: 6054
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For future reference: All posted code and error messages should be enclosed in "Code" tags. See this link: UseCodeTags
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!