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

  • Home
  • SEARCH
  • 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 6195867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:32:39+00:00 2026-05-24T03:32:39+00:00

EDIT3: It is defiantly the compiler flags causing the problem, if I compile from

  • 0

EDIT3: It is defiantly the compiler flags causing the problem, if I compile from the command line using Microsoft’s compiler it works fine. Does anyone know what I need to change in code::blocks to fix this issue?

When I run my code I am getting a UnsatisfiedLinkError. The load step works fine, i am getting the error when it actually calls the code.

Started with the path to my dll

java -Djava.library.path=E:\Java\JNIHellowWorld\PasswordGenHW\bin\Debug -jar dist\JNIHellowWorld.jar

The Exception

Exception in thread "main" java.lang.UnsatisfiedLinkError: jnihellowworld.Main.HelloWorld()Ljava/lang/String;
        at jnihellowworld.Main.HelloWorld(Native Method)
        at jnihellowworld.Main.main(Main.java:16)

Java Code

package jnihellowworld;
import java.io.IOException;
public class Main {
    public native String HelloWorld() throws Error;
    public static void main(String[] args) throws IOException {
        try
        {
        System.loadLibrary("PasswordGenHW");
        String test = new Main().HelloWorld(); //errors on this line
        System.out.println(test);
        System.in.read();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

C++ header

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class jnihellowworld_Main */

#ifndef _Included_jnihellowworld_Main
#define _Included_jnihellowworld_Main
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     jnihellowworld_Main
 * Method:    HelloWorld
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_jnihellowworld_Main_HelloWorld
  (JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif

C++ cpp

#include "jnihellowworld_Main.h"
#include <jni.h>

JNIEXPORT jstring JNICALL Java_jnihellowworld_Main_HelloWorld
  (JNIEnv *env, jobject obj)
  {
      return env->NewStringUTF("Hello world!");
  }

I am using Code::Blocks and GCC to complle the dll.

EDIT: Here is the dumpbin /exports of the dll

2    1 000011D8 Java_jnihellowworld_Main_HelloWorld@8

EDIT2: simplified project to duplicate error using system.loadLibrary()

  • 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-24T03:32:39+00:00Added an answer on May 24, 2026 at 3:32 am

    I ended up just compiling by hand using the Microsoft’s compiler.

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

Sidebar

Related Questions

EDIT3: It seems that the problem occurs on my localhost XAMPP PHP 5.3 setup,
EDIT3: It seems that the problem occurs on my localhost XAMPP PHP 5.3 setup,
edit3: i added the webconfig from the server edit2: I ran the log and
Using this example coming from Wikipedia, in which DrawSquare() calls DrawLine() : (Note that
edit3: i am using this script inside a facebook app, and not sure how
I'm trying to solve my first really hard EXC_BAD_ACCESS problem. I see from a
Edit: From another question I provided an answer that has links to a lot
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
I am currently trying to move from asp.net mvc 1.0 to 2.0 in an
I'd like to upgrade from Java 5 to Java 6. We all know about

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.