• Post Reply Bookmark Topic Watch Topic
  • New Topic

Store and retrieve user selected image NOT in jar file  RSS feed

 
Daan Heuvelbeuk
Ranch Hand
Posts: 85
MySQL Database Netscape Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Short questions: What do I need to do to store an user specific image outside a jar file?

In my application an user can track time spend on (work related) tasks. I'm more or less at the end of my project before I can ship the application to my customer. I'm currently testing the jar file in which I want to ship all relevant files, including images that come with the application.

In the application the user can choose his/her own image. This image is stored in the same directory as the application specific images. But I can not store the user specific image in the jar file.

I was thinking about something like this:

Ergo: I think about storing the user image in the same directory where the jar file is.

At the moment I store the user image with the following method:

String fileName will be something like userspecific.gif. How do I change method sameImage so that I store userspecific.gif in the same directory as the jar file?

PS. I looked at "Lesson: Packaging Programs in JAR Files" but could not find the required information.

Edit: fixed typo and clarified meaning
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daan Heuvelbeuk wrote:In the application the user can choose his/her own image. This image is stored in the same directory as the application specific images. But I can not store the user specific image in the jar file.

The user's home directory would be one logical choice.

In your code, you can look up (and use) the custom image if it exists, else fall back on the default one
 
Daan Heuvelbeuk
Ranch Hand
Posts: 85
MySQL Database Netscape Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
The user's home directory would be one logical choice.


That was the obvious location I did not consider. Thanks.
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, you can find the user's home directory by getting the system property "user.home". If you're going to be creating a lot of files in that directory on behalf of your application, you might also consider making a sub-directory of the user's home directory for that purpose.
 
Daan Heuvelbeuk
Ranch Hand
Posts: 85
MySQL Database Netscape Windows XP
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:By the way, you can find the user's home directory by getting the system property "user.home".


Thanks Paul for our 'system property "user.home"'. That gave me the possibility to find what I had to change fast to get a working system. I have delivered a rough version to my launching customer with an installation manual.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!