Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse doesn't recognize custom classes despite correct setup

I have the following setup in my project:

com.foo
 - Main
com.foo.util
 - StringUtil

In Main I import the StringUtil using

package com.foo;
import com.foo.util.StringUtil;

And use it just as you would use it;

StringUtil string = new StringUtil();

Yet, eclipse keeps telling me that StringUtil cannot be resolved to a type - how can this be?

I already tried refreshing the project, reimporting it as a new project, clicked through the build paths but everything seems to be set up correctly.

But still, eclipse doesn't recognize the class and won't compile my project.

like image 936
F.P Avatar asked Mar 23 '26 22:03

F.P


1 Answers

EDIT: The original question had this format:

package com.foo;
import com.foo.StringUtil;

Thus my answer was:

Because StringUtil is in com.foo.util and not in com.foo.

Change it to import com.foo.util.StringUtil.

like image 156
Pimgd Avatar answered Mar 26 '26 12:03

Pimgd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!