• Post Reply Bookmark Topic Watch Topic
  • New Topic

non-static method finder(java.lang.String) cannot be referenced from a static context  RSS feed

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,



When am compiling then it says:


Please advise
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Declare your finder() method to be static.
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because main() has been declared static it can only access other static methods and fields.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your favorable reply.

I declared the method static and its compiled but output is:
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know for a fact that you have a .css file in that directory? Do you need to look in subdirectories?
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Try this.
 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like you are trying to find .css in a folder meant to hold class files.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your favorable reply

Code is compiled but not displaying any file whereas 16 *.css files exists in this ROOT folder. Please Note I changed path to root instead of classes folder

 
Carey Brown
Saloon Keeper
Posts: 3315
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you expecting to recursively visit each subfolder? If so, you'll have to add more code because what you have won't do that.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks from the bottom of my heart
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!