I\'ve had this problem a few times, where I\'ve created another class file and the main class file can\'t find it. Here\'s the main class file:
package text
Make sure the java files are all in the textfiles
directory:
textfiles/FileData.java
textfiles/ReadFile.java
And run:
javac textfiles/FileData.java textfiles/ReadFile.java
java textfiles.FileData
Your code works without any modification. I think you are compiling from a wrong directory:
C:\Users\Liloka\Source>javac FileData.java
Move the FileData.java
to the textfiles
directory.
You have to compile all the java files used by your main class. As ReadFile is used by FileData you have to compile it too.
Did you tried
javac Filedata.java ReadFile.java
or
javac *.java
?
There must be a conflict with generated classes. Just try to remove all the classes that have been generated and build project again.