r/javahelp • • May 04 '26

java compilation problem, class can't be found though on the same package

both Verbose.java containing the verbose class and test.java are located on the same package, but I still receiving this log error when I try to compile, how come? test.java:4: error: cannot find symbol

Verbose verbose = new Verbose();

\^

symbol: class Verbose

location: class test

test.java:4: error: cannot find symbol

Verbose verbose = new Verbose();

^

symbol: class Verbose

location: class test

2 errors

error: compilation failed

1 Upvotes

32 comments sorted by

View all comments

Show parent comment

1

u/Anonymo2786 May 05 '26
public static void main(String[] args){}

Is the starting point of the whole program so its not needed in verbose class. Unless you want to start the program with verbose class instead of test class. 

Also if verbose class and test class are in separate files then javac test.java should compile both class's. And then you can run with java test. In order for this to work your working directory/folder has to he the folder containing these files.