Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class not found error

 
Kene Francis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone. I really think this is a very great place to talk about java. I have this problem anytime i'm compiling, i have to save the name of my program as "myProgram.java". Please, i would like to know how i can solve this problem. Thank you very much for your assistance.
 
Nguyen Ngoc Giang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What IDE are you using? In Java, your filename must be the same with your public class. Should you check whether your IDE set your classname by default ?
 
Carl Wilburn
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you having the problem when you are compiling or when you are attempting to execute the program after compiling? class not found errors usually come during the execution process using the java interpretter.

can you cut/paste the exact command and error you are getting into a note?
 
Kene Francis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The filename is always the same with my public class. The problem really is that anytime i have to save my programs, they have to be between qoutes. For example: "myProgram.java" . If i don't do it this way, i'll receive error when compiling, and if i check the icon it's with the extension .txt instead of .java. Besides that though, they run compile and run perfectly. Thank you very much for your assistance.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12125
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you using Notepad? if so, when you save, there are two (maybe 3) boxes at the bottom. one is the filename, the other is the file type. if the type is set to ".txt", Notepad appends that to the end of the name, unless you put it in double quotes (which sounds like what you're saying.

if you change that bottom box to "all files" (or whatever), then you don't have to use quotes.
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A minor subnote... convention calls for classes to be capitalized, thus MyProgram.java, as opposed to myProgram.java
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Kene!

Your problem possibly surrounds a "feature" of the Windows operating sytem, where it hides file extensions from you because it thinks you're now bright enough to understand them.

Follow these steps to turn off this feature, if you like:
  • Open any Windows explorer (not internet explorer) window.
  • In the "Tools" menu, select "Folder Options..."
  • In the "View" tab of the "Folder Options" window, deselect the "Hide extensions for known file types" option.
  • Click "Apply"
  • Click "Apply to All Folders"
  • Success?
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Moving this to the General Computing forum...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic