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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:47:32+00:00 2026-06-15T09:47:32+00:00

I am entering into Java world just now. I am facing problem when I

  • 0

I am entering into Java world just now. I am facing problem when I try to compile sample program for Calling C from Java.

I wanted to try the sample code for JNI (Which is given in JNI.PDF from SUN-Micro).

The code is some thing like this:

class HelloWorld {
  private native void print();
  public static void main(String[] args) {
    new HelloWorld().print();
  }
  static {
    System.loadLibrary("HelloWorld");
  }
}

I compiled using javac HelloWorld.java and after that got .H file for C program using “javah -jni HelloWorld”

Even my C code is also simple with :

#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
JNIEXPORT void JNICALL
Java_HelloWorld_print(JNIEnv *env, jobject obj)
{
  printf("Hello World!\n");
  return;
}

I created .dll in Cygwin using “gcc -Wl,–add-stdcall-alias -shared -o HelloWorld.dll HelloWorld.c”

Even I used normal Linux method of Creating Shared Lib: “gcc -shared -Wl,-soname,libHelloWorld.so -o libHelloWorld.so HelloWorld.o”

But when I run java HelloWorld, it return Aborted!

Since i dont have much idea in Java, I am not sure where I going wrong.

I checked similar code present in few websites like: http://www.inonit.com/cygwin/jni/helloWorld/ but getting similar error.

  • 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-06-15T09:47:33+00:00Added an answer on June 15, 2026 at 9:47 am

    The InOnIt page uses -mno-cygwin. If you want Cygwin functionality, then you’ll want http://elliotth.blogspot.com/2005/08/porting-jni-code-to-win32-with-cygwin.html. Terminator’s moved since that was written. The crux of the source you’d want for a Cygwin-safe Java launcher is now at https://github.com/software-jessies-org/jessies/blob/master/salma-hayek/native/all/java-launcher/java-launcher.cpp.

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

Sidebar

Related Questions

Before Entering data into a database, I just want to check that the database
I know about C and I am entering into Java and confused about its
I know I can do the following to prevent debugger from entering into Subroutine
I am collecting data every five minutes and entering it into a MySQL database.
I am injecting javascript into a page via autohotkey by entering javascript:blahblahblah into the
What i'd like to generate into method bodies: private void SomeMethod() { Logger.Log(Entering SomeMethod.);
How can I let my users to log into a phpBB forum by entering
Entering a value such as 27.8675309 into the Decimal representation field of the IEEE
I am using spring exception translator to wrap java exception into flex exception. public
I would like to know some of the things before entering into the arena

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.