The way to entry Home windows Registry From Java

The Home windows registry is a fancy, statistical database that incorporates many entries describing what's subsequent achieved with Home windows. Designers generally must entry the Home windows registry inside Java functions or functions to learn from the registry, write current keys or add new keys, however this may be tough as a result of there isn’t any direct motion for this process in Java.

As an alternative, third-party software program often requires entry to the registry. One such broadly used free software is named the JNI Registry Library. This Solar permitted library can be utilized to entry Home windows registry in addition to for Java programs for software program improvement.

The method might be fairly difficult and is greatest tried by superior customers; business software program to entry home windows registry from java is way simpler to make use of (typically merely requires a number of clicks of the mouse) and often fairly reasonably priced. Virtually all processes to entry Home windows registry with out utilizing enterprise know-how would require code, hacks and not less than one obtain, if no more. The next is among the easiest strategies, utilizing the smallest variety of code and downloads, to create entry to the Home windows registry from Java.

Go to a good website to obtain the file assortment.

] Proper click on on the zip file you downloaded down and choose "Create," then choose the suitable location for the information.

Double click on the icon proper now in your desktop to open Java IDE (built-in improvement surroundings). When the applying is open, choose "File" after which click on "New Java Class" to begin a brand new Java class.

You have to now enter the JNI registration date file into your new class. To do that, it is advisable paste a protracted code into the clean file. This code needs to be enough:


Now you could add new RegistryKey and Registry class cases. As soon as achieved, you possibly can open and edit the registry instruments you had been on the lookout for within the Java software or software. Use this code for this objective:

Registry myRegistry = Enrollment ();
Registry myRegistryKey = Registry.HKEY_CURRENT_USER;
Registry myKey = registry.openSubkey (myRegistryKey,

Software program Microsoft CurrentVersion Explorer Superior ", RegistryKey.ACCESS_ALL);
Now you can entry the important thing within the Home windows registry to to entry or edit and alter its worth. You have to use "strive loop" to entry the registry whereas on Java as a result of generally Java will create a registration permission to stop the Java software from failing. having run by the trial story whereas on Java you should have full registry choices. The final quantity it is advisable get this final step is as follows:

strive RegsitryValue myRegistryValue = myKey.getValue ("okay "
myKey.setValue (" Check Worth ", myRegistryValue);
myKey.deleteValue (" okay ");
seize (RegistryException reEx)

Different often used device used to open Home windows registry may also be downloaded wherever copies of JWinAPI. That is extra difficult than the one described above, however it’s recognized to be efficient.

Supply by Ryan Jennings Smith

Leave a Reply

Your email address will not be published. Required fields are marked *