• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

class.getResource() + netbeans, not working?

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,
ClassName.class.getResource("fileName"), is appropriate method for getting resources.

Now when i run single file in netbeans(by right click->run "filename.java") , It is unable to locate resource. (When i run whole project, it finds it)

How to overcome from this problem, it's really bugging me.

Thanks,
Nachiket
 
Nachiket Patel
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it,
When you run your code from IDE. It runs from build.
And if you created file, and compile that file only,
then resource files will not be copied there.
But once you clean and build your project, your all class files and resource files will be in build folder. So now when you run single file from netbeans it will run.
 
Nachiket Patel
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it,
When you run your code from IDE. It runs from build.
And if you created file, and compile that file only,
then resource files will not be copied there.
But once you clean and build your project, your all class files and resource files will be in build folder. So now when you run single file from netbeans it will run.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic