• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Loading files contained in jar

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm building JAVA Swing APP.
the app include some picture; for now the picture load from a specific path in my PC.
I wondering if there is any wat to upload the files into the project and load it from there.
the main purpose is to share this project with other people.

thanks
 
Saloon Keeper
Posts: 7162
165
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are distributing the app as a jar file, you can include any resources in the jar file, and load them via something like

InputStream inputStream = getClass().getClassLoader().getResourceAsStream("image.png"))
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic