• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File not found error

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I just wrote my first program of java and saved it with Party.java with no .txt extension (also i made sure to "uncheck the option HIDE EXTENSION FOR KNOWN FILE TYPE" so that file doesn't convert to .java.txt extension).
Location of the file : C:\Users\lenovo\Documents
PATH variable : C:\Program Files\Java\jdk-13.0.2\bin
Name of the file : Party.java

Error - file not found: Party.java

help!!!
I am stuck on this problem for like 2 hours :/  
 
Saloon Keeper
Posts: 10705
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What program are you using to open the file with? Are you entering the file name on the command line? What does the command line look like?

What directory are you in when you start the program?

Note that .java files are not usually put directly into the Documents folder but something more like:
C:\users\me\Documents\Java\myproject\src\myfile.java

Then to compile you first change directory:
cd \users\me\Documents\Java\myproject\src

and compile
javac myfile.java
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I presume that is only the first part of your PATH, otherwise your computer won't work. Please use the dir command in the folder where you expect to find your Party.java file. If you find it, did you set a CLASSPATH? Try this instruction:-A system CLASSPATH usually does more harm than good.

Is that file copied from Head First Java by Sierra and Bates? The Party class is incomplete and cannot be executed as it stands.
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stop using MS notepad; download NotePad++ instead. It is a much better programming editor.
 
Aditya Agrawal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ! it can find the file now.
Although i am using command prompt on windows to open the file.
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done finding it, but what was the problem?
 
Rancher
Posts: 144
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Stop using MS notepad; download NotePad++ instead. It is a much better programming editor.


Well, although I agree with you that using standard M$ windows notepad is a bad choice, and notepad++ is usually widely used amongst devs - there're other alternatives like notepad2 and others. May rewrite to you suggesting notepad++ instead of, well, demanding it - as that's what your current post reads like ... (no offense).
 
Aditya Agrawal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

I presume that is only the first part of your PATH, otherwise your computer won't work. Please use the dir command in the folder where you expect to find your Party.java file. If you find it, did you set a CLASSPATH? Try this instruction:-A system CLASSPATH usually does more harm than good.

Is that file copied from Head First Java by Sierra and Bates? The Party class is incomplete and cannot be executed as it stands.



Yeah,i actually copied it from head first!
 
Aditya Agrawal
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Well done finding it, but what was the problem?



compiler wasn't able to locate the file.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the command line, cd in C:\Users\lenovo\Documents and type this:

   javac Party.java

What happens?  Copy the exact error message if there is one.

Also, is the class in Party.java called Party?
 
reply
    Bookmark Topic Watch Topic
  • New Topic