• 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

Serialization location

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to serialize an object to a specific location? I have a class (will post code) in a package that I "C:\>java" from the \classes directory, where the \com folder is, and it serializes the object in \classes, as opposed to the location of the actual class file.

 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use a relative path name in a FileOutputStream, then that path is relative to the current working directory. If you want it to go somewhere else, then use an absolute path. (This is simply a fact about path names, not about serialization per se.)

I don't think it's a good idea to put changeable data in the same directory where your classes are located, anyway. Perhaps you should put your data in the user's home directory, or a subdirectory of that which you create specifically for your application.
reply
    Bookmark Topic Watch Topic
  • New Topic