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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:46:20+00:00 2026-05-27T00:46:20+00:00

I want to create a simple JNI layer. I used Visual studio 2008 to

  • 0

I want to create a simple JNI layer. I used Visual studio 2008 to create a dll (Win 32 Console Application project type with DLL as the option). Im getting this exception when I invoke the native method:

Exception occurred during event dispatching:
java.lang.UnsatisfiedLinkError: com.tpd.vcdba.console.TaskScheduler.vcdbaTaskSch
edulerNative.Hello()V
        at com.tpd.vcdba.console.TaskScheduler.vcdbaTaskSchedulerNative.Hello(Na
tive Method)
        at com.tpd.vcdba.console.TaskScheduler.vcdbaTaskSchedulerUtil.isTaskExis
ts(vcdbaTaskSchedulerUtil.java:118)
        at com.tpd.vcdba.console.Dialogs.schedulerWizardPage.scheduleTaskPage.wz
Finish(scheduleTaskPage.java:969)
        at com.tpd.vcdba.console.wizard.vcdbaWizard.gotoFinish(vcdbaWizard.java:
434)
        at com.tpd.vcdba.console.wizard.wzActionPanel.actionPerformed(wzActionPa
nel.java:163)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

The header file generated is :

/* DO NOT EDIT THIS FILE - it is machine generated */

    #include <jni.h>
    /* Header for class com_tpd_vcdba_console_TaskScheduler_vcdbaTaskSchedulerNative */

    #ifndef _Included_com_tpd_vcdba_console_TaskScheduler_
    vcdbaTaskSchedulerNative
    #define _Included_com_tpd_vcdba_console_TaskScheduler_
    vcdbaTaskSchedulerNative
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     com_tpd_vcdba_console_TaskScheduler_vcdbaTaskSchedulerNative
     * Method:    Hello
     * Signature: ()V
     */
    JNIEXPORT void JNICALL Java_com_tpd_vcdba_console_TaskScheduler_vcdbaTaskSchedulerNative_Hello
      (JNIEnv *, jobject);

    #ifdef __cplusplus
    }
    #endif
    #endif

The implementation file is:

#pragma once
#include "com_tpd_vcdba_console_TaskScheduler_
vcdbaTaskSchedulerNative.h"
#include "stdafx.h"
#include "jni.h"

/*
 * Class:     com_tpd_vcdba_console_TaskScheduler_vcdbaTaskScheduler_native
 * Method:    Hello
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_tpd_vcdba_console_TaskScheduler_vcdbaTaskSchedulerNative_Hello
  (JNIEnv *envs, jobject obj){
    printf("hello world");
}

The java file is:

package com.tpd.vcdba.console.TaskScheduler;


import com.tpd.vcdba.console.TaskScheduler.ScheduleTask;

public class vcdbaTaskSchedulerNative {


    public native void Hello();
    private static vcdbaTaskSchedulerNative instance = null;

    static{
        try{
            System.loadLibrary("JNITrial");

        }
        catch(Exception ex){

        }

    }

    public vcdbaTaskSchedulerNative(){

    }

    public static vcdbaTaskSchedulerNative getInstance(){
        if(instance == null){
            instance = new vcdbaTaskSchedulerNative();
        }
        return instance;
    }

}

When I invoke the native method “Hello” i get the execption.

Another thing I observed is that when I compile in command line using:
“cl -I”C:\Program Files (x86)\Java\jdk1.7.0\include” -I”C:\Program Files (x86)\Java\jdk1.7.0\include\win32″ -LD “C:\Users\administrator.RMDOM\Documents\Visual Studio 2008\Projects\JNITrial\JNITrial\JNIInt.cpp” -FeJNITrial.dll” ,
everything works fine.

Am I missing out something in Visual Studio Settings? I have option Use of MFC as “Use MFC in a Shared DLL”, Code generation option as “Multi-threaded DLL (/MD)”. Its a 64 bit dll.
Is there something else that I need to add?

Any help is welcome.
Thanks in advance.

  • 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-27T00:46:20+00:00Added an answer on May 27, 2026 at 12:46 am

    I figured out the solution.

    My project had use precompiled headers option set, so the compiler was skipping the statement:

    #include "com_tpd_vcdba_console_TaskScheduler_vcdbaTaskSchedulerNative.h"
    

    Once I removed that option it worked like magic.

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

Sidebar

Related Questions

I want to create a simple batch file that would perform some Visual Studio
I want to create simple form using CForm (yii framework) but 'elements' => array('username'=>array('type'=>'text'))
I want to create simple application like android image gallery but I don't want
I want to create simple Spring MVC Hello world application that runs under Jetty
I want to create a simple structure that holds an identifier of type int
I want to create a simple auditing system for my small CodeIgniter application. Such
I want to create a simple application using the classes in System.Reflection.Emit. How can
I want to create a simple web based application on Android that loads certain
I want to create a simple application which performs some calculations and then draws
I want to create a simple Mac application bundle which calls a simple Python

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.