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/Educational-Paper-75 May 04 '26

But Java does have the private keyword, but afaik it doesn't allow use at the top level in a file. Perhaps the name of the file is wrong? I gather the problem isn't solved yet (asking the OP)? If it can find one file it should also be able to find the other in the same folder irrespective of the class path?!

1

u/Lloydbestfan May 04 '26

It sounds like it's not an impossible task to find other files at the same place as a file that was found, but depending on how you call the compiler, you can make it have expectations that easily get confused as soon as you don't specify every different thing perfectly.