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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:03:21+00:00 2026-05-18T09:03:21+00:00

I want to include a C library in my Java project via JNI. I

  • 0

I want to include a C library in my Java project via JNI. I wrote the necessary JNI wrapper code and I have compiled and tested it in a Linux environment using gcc and make. Now I need to compile this to make a 64 bit Windows DLL, and I cannot get it to compile.

I downloaded Visual C++ Express 2010 and I have been using cl.exe on the command line. In the absence of knowing any better way to do it, I have just called cl.exe with all of the files I want to compile as arguments. I get a variety of errors:

Command line warning D9024: unrecognized source file type 'svm_jni.h'...

and

svm_jni.c(63) : error C2275: 'jobject' : illegal use of this type as an expression...

The first problem I have discovered is do to the fact that cl.exe does not accept .h files (I guess its only meant for C++ instead of C?). Is there a workaround for this? I could change all of the .h files to .c files and change the include statements, but I would prefer not to do this.

I have tried compiling using make and gcc on MinGW, but it always says that it cannot compile to a 64 bit target.

I have tried doing things through VC++ using the makefile project type, but I could not figure out how that works.

Any suggestions?

EDIT: I removed the .h files from the command line arguments and that solves part of the problem. I have been using

-I "C:\Program Files\Java\jdk1.6.0_21\include" -I "C:\Program Files\Java\jdk1.6.0_21\include\win32"

to get jni.h and jni_md.h. I still get

svm_jni.c(63) : error C2275: 'jobject' : illegal use of this type as an expression
    C:\Program Files\Java\jdk1.6.0_21\include\jni.h(83) : see declaration of 'jobject'

and a bunch of syntax and weird errors after that. I am assuming all the errors are the result of a common problem, but I don’t know whats going wrong.

Is there a 64 bit version of jni_md.h? The one I’m using now is in \include\win32

  • 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-18T09:03:22+00:00Added an answer on May 18, 2026 at 9:03 am

    You don’t really want to compile the header files, rather you want to include them in your compilation path when you compile the c/c++ files.

    As for the jobject issue, you need to include the jni header files which are located under the %JAVA_HOME%\include directory.

    For Visual C++ Express, did you download the 64 bit building tools? And when you state that gcc and MinGW cannot compile to a 64 bit target, what message are you getting exactly? Do you have minGW-w64?

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

Sidebar

Related Questions

I want to include a C library in my Java project via JNI. I
I have a java compiled library in a jar.for which i have written documentation
I have a file that I want to include in Python but the included
I have a MySQL query in which I want to include a list of
I have two classes, and want to include a static instance of one class
How would I achieve the pseudo-code below in JavaScript? I want to include the
I'm writing a library that needs to have some code if a particular library
I am working on a Java project that I want to deliver to my
I want to have achieve something similar to Java Tiles framework using only client
I was just about to include the HtmlUnit library in a project. I unpacked

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.