• Latest
  • Trending
  • All
  • News

How to Access Windows Registry From Java

February 8, 2018
5 Vital Car Cleaning Tools To Make A Car Look Brand New

How Exterior Detailing Services Can Enhance the Look of Your Vehicle

January 21, 2024

The Ultimate Guide to Rebuilding a Transmission – Everything You Need to Know

December 10, 2023
5 Weekend Travel Tips for Lasting Joy With the Family

Preparing Your RV For Storage – Essential Steps to Take

November 21, 2023

5 Reasons Why Regular Auto Repair Services Are Crucial for Your Vehicle

November 21, 2023
Comparing the Services of Open Vs. Enclosed Car Shipping

Comparing the Services of Open Vs. Enclosed Car Shipping

November 20, 2023
Heavy Vs. Light Duty Towing: Knowing The Kind of Truck You’ll Need

Heavy Vs. Light Duty Towing: Knowing The Kind of Truck You’ll Need

November 11, 2023
6 great reasons why vehicle owners won’t be stranded when calling out a local locksmith

6 great reasons why vehicle owners won’t be stranded when calling out a local locksmith

October 27, 2023
Six Reasons to Buy a Classic Corvette

Six Reasons to Buy a Classic Corvette

October 20, 2023
Top 5 Signs of Alternator Problems

Top 5 Signs of Alternator Problems

October 10, 2023
7 Common Engine Rebuilding Mistakes and How to Avoid Them

The Benefits of Reliable Auto Repair Services You Can Trust

October 9, 2023
Practical Car Interior Gadgets to Upgrade Your Ride

Top Reasons Why Used Cars Are a Better Investment

July 2, 2023

Essentials of Handicap Vehicles

June 20, 2023
  • Guest Posts
  • Advertise
  • Contact
  • Privacy Policy
Saturday, June 28, 2025
  • Login
Tech Featured - Automotive
  • Home
  • Gadgets
  • Automotive News
  • Interesting Topics
No Result
View All Result
Tech Featured - Automotive
No Result
View All Result
Home News

How to Access Windows Registry From Java

February 8, 2018
in News
0
93
SHARES
266
VIEWS
Share on FacebookShare on Twitter

The Windows registry is a complex, hierarchical database that includes a multitude of entries detailing information about just about anything done using Windows. Developers sometimes need to access the Windows registry from inside a Java applet or application in order to read from the registry, write to current keys, or add new keys, but this can be difficult since there is no outright function for this task in Java.

Instead, usually third party software is needed to access the registry. One such widely used free program is called the JNI Registry library. This Sun approved library can be used to access the Windows registry as well as for Java classes for software development.

The process can be somewhat complex and is best attempted by advanced users; commercially available software to access the Windows registry from Java is much simpler to use (often simply requiring a few clicks of the mouse) and usually quite cost effective. Almost any process to access the Windows registry without using commercial software will require codes, hacks, and at least one download, if not more. The following is one of the more straightforward methods, using the least amount of codes and downloads, to create access to the Windows registry from Java.

Visit a reputable site to download the registry library.

Right click the zip file you downloaded and select “Extract To,” then select the desired location for the files.

Double click the icon now on your desktop to open the Java IDE (integrated development environment). Once the program is open, select “File,” then click on “New Java Class” to start a new Java class.

You will now import the JNI registry class documents into your new class. To do this, you will need to paste a long code into the blank class file. This code should be sufficient:

import com.ice.jni.registry.Registry;
import com.ice.jni.registry.RegistryException;
import com.ice.jni.registry.RegistryKey;
import com.ice.jni.registry.RegistryValue;

Now you must add new RegistryKey and Registry class instances. Once that is complete, you can then open and edit the registry keys you were looking to access in your Java application or applet. Use this code for those purposes:

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

“Software\Microsoft\CurrentVersion\Explorer\Advanced”,RegistryKey.ACCESS_ALL);
You can now get to the key value in the Windows registry setting to be accessed or modified and then alter its value. You must use a “try loop” to access the registry while in Java because sometimes Java will create a registry exception in an attempt to prevent the failure of the Java program. After running through the try loop while in Java, you will have complete registry options. The last code you need to for this final step is as follows:

try { RegsitryValue myRegistryValue= myKey.getValue(“ok”);
myKey.setValue(“Test Value”, myRegistryValue);
myKey.deleteValue(“ok”); }
catch(RegistryException reEx) {}

Another frequently used tool used to access the Windows registry can also be downloaded anywhere a copy of JWinAPI is available. This is a more complex tool than those described above, but is known to be effective.

Tags: JavaRegistryWindows
Share37Tweet23Share9
  • Trending
  • Comments
  • Latest

John Christie Electric Generator – Generates 24 Kilowatts Of Free Electricity

November 21, 2016

How to Use a Magnetic Generator to Get Rid of Your Electricity Bill

November 21, 2016

Buying a Gazebo – How to Install a Gazebo on Grass

June 8, 2017

The Environmental Benefits of Automobile Recycling

0

Automotive Fasteners – A Number of Items Included on the List

0

Drag Racing – The Perfect Launch

0
5 Vital Car Cleaning Tools To Make A Car Look Brand New

How Exterior Detailing Services Can Enhance the Look of Your Vehicle

January 21, 2024

The Ultimate Guide to Rebuilding a Transmission – Everything You Need to Know

December 10, 2023
5 Weekend Travel Tips for Lasting Joy With the Family

Preparing Your RV For Storage – Essential Steps to Take

November 21, 2023
Tech Featured - Automotive

Navigate Site

  • Guest Posts
  • Advertise
  • Contact
  • Privacy Policy

Follow Us

No Result
View All Result
  • Home
  • Gadgets
  • Automotive News
  • Interesting Topics

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In