Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Input files in program path  RSS feed

Adam Sailer
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not even sure how to ask this..
I'm writing a java application that stores its data in a text file. Whenever the user changes (adds/deletes/modifies) data, the file needs to be re-written. The program needs to read the input file on startup. I want the program to "know" that it needs to look in the same directory that the program itself is in for this input file, even if the user moves all of the program files to a different directory.
Now, if I can set a button icon to an image in the classpath with:
selectFileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sorttable/icons/Forward16.gif")));
Shouldn't I be able to do something similar with input fils?
Eventually I want to be able to save serialized objects to a subfolder based on type.... I cannot get away with hardcoding file paths..
Any help is appreciated." rel="nofollow">
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!