aspose file tools*
The moose likes Linux / UNIX and the fly likes Rigistry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Rigistry" Watch "Rigistry" New topic
Author

Rigistry

Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 290

Hi all

i want to know is linux have registry.
Because i have an application in java. I want to write some data to registry from that application.
In windows its working fine i don't know is this will work with Linux or i need to modify the code to work in linux.

Please help me


-Chiru
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

Linux systems generally do not have a registry in the same way that Windows has.

What information do you need to read or write? On Unix-like systems, applications usually write configuration files to the user's home directory, using a filename that starts with a . (dot), which makes the files hidden.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 290

But i need to take care of Accidental deletion of that file but in windows its safe if it is in the Registry
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
Check out the Preferences API (in java.util.prefs). It saves application settings and the like in a way that's appropriate for the host OS (which on Windows is the Registry).
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 290

Originally posted by Ulf Dittmer:
Check out the Preferences API (in java.util.prefs). It saves application settings and the like in a way that's appropriate for the host OS (which on Windows is the Registry).


Then if i run my application in linux it will take care of saving registry entry in Linux am i right
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42946
    
  70
It will save the setting, yes. How it does it depends on the JVM implementation. The Registry in particular is a Windows-only thing.
[ July 18, 2008: Message edited by: Ulf Dittmer ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Originally posted by Chiru Raj:
But i need to take care of Accidental deletion of that file but in windows its safe if it is in the Registry


Yes, and when the hard drive fails, you either have to restore the registry from a backup - which can fail if the new drive configuration doesn't match OR you have to recreate the entire registry from scratch, which means finding all the application install disks, re-installing each and every one of the apps, adding the app updates and service packs, and generally spending about a week just to get basic system functionality back. Oh wait, I'm showing my age. Nowadays you also have to make the reinstalled apps phone home and register with the software vendor.

Or to say it another way - in Linux, if you delete a file, you lose the file. In Windows, if you corrupt the registry, you've lost the entire registry!

The registry was a good idea, and it served a very useful purpose back when FAT sector sized were very large and config files were very small. However, things have changed a lot, and the downsides of the registry have become apparent. Not only do you put all your eggs in one basket - that basket has a proprietary binary format. Linux/Unix config files are normally text files. They can be backed up and restored using ordinary archive utilities and they can be scanned and/or modified in bulk using ordinary text utilities.

I do, in fact, back up my /etc directory tree on a daily basis using a cron-scheduled tar job.

Back in the Windows world, some developers have gotten fed up with registry headaches and gone back to ini files. The registry has one advantage over ini - which is that you can build a hierarchy instead of just a flat option tree, but these days so do XML config files.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rigistry