Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6212025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:26:22+00:00 2026-05-24T06:26:22+00:00

Im currently working on a java program and I need to read/write to the

  • 0

Im currently working on a java program and I need to read/write to the registry. i’ve looked at several API’s to do this and I found ini4j (ini4j Project Page). I also need to edit ini files so I like this solution because it does both. I’m curious if anybody has tried ini4j in this type of scenario?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:26:24+00:00Added an answer on May 24, 2026 at 6:26 am

    I found a better solution for reading/writing to the registry without the need for ini4j or passing arguments to the command line. I use JNA quite a lot in my program so I figured that it would be easier to use native library calls instead of including an additional library to do this for me. Here is an example from my project were I search through the registry looking for a specific key. The specific key is also dependent on whether or not the OS is x64 or x86.

       public static String GetUninstallerPath() {
            try {
                //if (logger.IsInfoEnabled) logger.Info("GetUninstallerPath - begin");
    
                String uninstallerPath = null;
    
                try {
                    String vncDisplayName = "UltraVNC";
                    String subkey32 = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
                    String subkey64 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
    
                    boolean is64Bit = Platform.is64Bit();
                    String[] key;
                    if (is64Bit) {
                        key = Advapi32Util.registryGetKeys(WinReg.HKEY_LOCAL_MACHINE,
                                subkey64);
                    } else {
                        key = Advapi32Util.registryGetKeys(WinReg.HKEY_LOCAL_MACHINE,
                                subkey32);
                    }
    
                    if (key != null) {
                        for (String nextSubkeyName : key) {
    
                            TreeMap<String, Object> subKey = Advapi32Util.registryGetValues(
                                    WinReg.HKEY_LOCAL_MACHINE,
                                    subkey64 + "\\" + nextSubkeyName);
                            Object value = subKey.get("DisplayName");
                            Object path = null;
                            if (value != null) {
                                if (value.toString().startsWith(vncDisplayName)) {
                                    path = subKey.get("UninstallString");
                                    if (path != null) {
                                        uninstallerPath = path.toString().trim();
                                    }
                                }
                            }
    
                        }
    
                    }
    
                }
                catch (Exception ex) {
                    System.err.println(ex.getMessage());
    
                }
    
                return uninstallerPath;
             }
        }  
    

    I use objects to initially store the key values because I kept getting NullPointerExceptions. Feel free to provide another solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working with Java to write a program that does an EAI between
I'm currently working on a Java project that is emitting the following warning when
I am coming from Java and am currently working on a C# project. What
I'm currently working on a project that is building a java-based desktop application to
I'm currently working on a WebSphere 6.1 Web Project. In my java code, how
I'm currently working on a hobby project, written in Java, containing about two different
I'm back with another similar question. I am currently working on a Java program
I am currently working on a simple line program in java. There will be
I am currently working with Java, MongoDB and several threads. For each threads, I
I'm have a java program that uses Apache httpclient api. This is used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.