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 6998157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:22:32+00:00 2026-05-27T20:22:32+00:00

I am trying to accessing dll methods in java which has been written in

  • 0

I am trying to accessing dll methods in java which has been written in c#. From the following code i am trying to build dll which is generated successfully.

using System;
using Microsoft.Win32;


namespace CyberoamWinHelper
{
    public class RegistryAccess
    {        
        public static String getValue(String key)
        {
            RegistryKey rk = Registry.CurrentUser;
            RegistryKey rk1=rk.OpenSubKey("Software\\Test", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl);
            rk1.SetValue(key, "val1");
            return rk1.GetValue(key).ToString();
        }
        public static void createSubkey(String name)
        {
            RegistryKey rk = Registry.CurrentUser;
            rk.CreateSubKey("Software\\Test");
        }
    }
}

After this i am loading the generated dll in my java program code of which is as follows

public class JNI {

    /**
     * @param args the command line arguments
     */
    public native String getValue(String key);    

    public static void main(String[] args) {
        // TODO code application logic here

        try
        {
            System.loadLibrary("CyberoamWinHelper");
            JNI j=new JNI();       
            System.out.println(j.getValue("abc"));
        }
        catch(UnsatisfiedLinkError  e)
        {
            System.out.println("Ex" + e.getMessage());
        }
    }
}

After running this code it is giving me the following error.

"Exjni.JNI.getValue(Ljava/lang/String;)Ljava/lang/String;"

Well i am not understanding what this error is saying but i want to solve it.
And one more question i am having is since the method i am calling is a static method will it be called in this way? i mean to call static method we need

“classname.methodname”

so here will it be able to call the method?

  • 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-27T20:22:32+00:00Added an answer on May 27, 2026 at 8:22 pm

    You can only call methods via JNI if those methods were in fact designed to be called this way. Your methods absolutely are not. What you’re doing here has (sorry to be so blunt) absolutely no chance of ever succeeding — it simply doesn’t work this way.

    There are several ways you might proceed. One would be to learn about JNI and how to write libraries that actually work with it. Here is the canonical reference for this. Doing this with C# adds yet another layer of complexity, though.

    Another way would be to give up on JNI altogether and use a more appropriate mechanism to access the methods. You can learn about JNA here; it would be entirely better suited to your goals.

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

Sidebar

Related Questions

I've been trying to search around web for guides/help for accessing byte code classes
I am trying to deny access to a sub-domain directory from people accessing directly
I'm trying to pass a string from C# to Delphi built DLL. Delphi DLL
I am trying to accessing webpages in C# which are built specifically for iPhones.
I've been researching all morning trying to find best practices for accessing your IoC.
I am trying to access data from a raw data stream. Before accessing the
Trying to block directory access from everyone except 1 IP address. This .htaccess code
what I'm trying to do is accessing snapText = scrollPane.source.textSnapshot; from an external swf.
I am accessing a business class using an ObjectDataSource and trying to produce output
I am trying to find a generic way of accessing a set of containers.

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.