Help needed with JNI -  java.lang.UnsatisfiedLinkError

I need some help with JNI. I am running on Sun Solaris 7 using their CC compiler. I wrote a simple java program that calls a native method to get a pid. Everything work until I use cout or cerr. Can anyone help? Below is what I am working with.
Note: The application works. The problem is when the C++ code tries to display text output.
My error log is as follows:
java Pid
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/dew/test/libPid.so: ld.so.1: /usr/j2se/bin/../bin/sparc/native_threads/java: fatal: relocation error: file /home/dew/test/libPid.so: symbol __1cDstdEcerr_: referenced symbol not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1382)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1306)
at java.lang.Runtime.loadLibrary0(Runtime.java:749)
at java.lang.System.loadLibrary(System.java:820)
at Pid.<clinit>(Pid.java:5)
Pid.java
========
* Pid: Obtains the pid from the jvm.
class Pid {
static { System.loadLibrary("Pid"); }
public native int getPid();
public static void main(String args[])
System.out.println("Before construction of Pid");
Pid z = new Pid();
System.out.println(z.getPid());
z = null;
Pid.cpp
=========
* Native method that obtains and returns the processid.
#include "Pid.h"
#include "unistd.h"
#include <iostream.h>
JNIEXPORT jint JNICALL Java_Pid_getPid(JNIEnv *env, jobject obj) {
/* cout << "Getting pid\n"; */
cerr << "Getting pid\n";
/* printf("Getting pid\n"); */
return getpid();

I forgot to include my build information.
JAVA_HOME = /usr/j2se/
LD_LIBRARY_PATH = ./:/opt/readline/lib:/opt/termcap/lib:/usr/bxpro/xcessory/lib:/${JAVA_HOME}/lib:/usr/RogueWave/workspaces/SOLARIS7/SUNPRO50/0d/lib:/usr/RogueWave/workspaces/SOLARIS7/SUNPRO50/3d/lib:/usr/sybase/lib
javac Pid.java
javah Pid
CC -G -I${JAVA_HOME}/include -I${JAVA_HOME}/include/solaris Pid.cpp -o libPid.so
Thanks again,
Don

Similar Messages

  • Help needed (the notorious java.lang.UnsatisfiedLinkError)

    Hello all.
    I'm using Eclipse 3.4.0 on Windows and getting the following error when trying to call a function from a dll which is located in the java project(Test) folder:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Test.hello()V
         at Test.hello(Native Method)
         at Test.main(Test.java:12)Any thoughts about why this problem is happening will be very appreciated.
    This is my simple code:
    Test.java
    public class Test {
         public native void hello();
         static {
              System.loadLibrary("hello");
         public static void main(String[] args) {
              new Test().hello();
    }test.cpp
    #include <iostream>
    #include "Test.h"
    JNIEXPORT void JNICALL Java_Test_hello
      (JNIEnv *env, jobject obj)
         std::cout<<"Hello World!"<<std::endl;
    }Test.h
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class Test */
    #ifndef _Included_Test
    #define _Included_Test
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     Test
    * Method:    hello
    * Signature: ()V
    JNIEXPORT void JNICALL  Java_Test_hello
      (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif

    Anton1981 wrote:
    Hello all.
    I'm using Eclipse 3.4.0 on Windows and getting the following error when trying to call a function from a dll which is located in the java project(Test) folder:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Test.hello()V
         at Test.hello(Native Method)
         at Test.main(Test.java:12)
    The exception tells you that java did not find the method that it was looking for.
    Your library was loaded otherwise another exception would have occurred.
    Per your posted code the above exception does not match (line 11 versus line 12). That could just be a cut and paste though.
    Presumably you do not have a package in Test because otherwise your C++ code does not match.
    Most problems of this sort are because the java method signature does not match the C method signature but your appears to be correct. But to be safe you might want to
    1. Delete the dll/h file
    2. Delete the class files
    3. Recompile java
    4. Rerun javah
    5. Confirm the signature still matches in your cpp file.
    6. Rebuild the dll.
    Also try running your code before step 6. If you get an exception besides one that says your library is missing then you still have a library somewhere (which is another source of possible problems.)

  • HELP !!! java.lang.UnsatisfiedLinkError

    Hi All,
    I am getting the error "java.lang.UnsatisfiedLinkError: gcNocompact at
    sun.misc.Gc$Daemon.run(Gc.java:102)" while running the java code in
    AIX. The document said that this is "Thrown if the Java Virtual Machine
    cannot find an appropriate native-language definition of a method
    declared native."
    What is the reason to cause this error ?
    Any suggestion to rectify this.
    Thanks in advance.
    TC8888

    I had the same problem when attempting to use lotus domino toolkit for java... I belive that the AIX is attempting to find a .dll or similar native piece of code, but it cant be found... You need to change your system parameter 'path' (not 'classpath') to include the location of the native code. Check the documentation.

  • Please HELP me with installation - java.lang.noclassdeffounderror:

    Please Help! For school we need to install JAVA. I installed JDK 5.0 and id did not work. I got exception in thread "main" java.lang.noclassdeffounderror: hello. I was using Texpad to write, compile, and run it. In short I deleted all JAVA 5.0 using My Computer program removal. I installed JAVA 1.4..2_10 and I am still getting that same error. I want the JAVA 1.4..2_10 to be installed and not JAVA.5.0.
    My System Variable CLASSPATH still shows C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip. My System Variable PATH has nothing as far as JAVA in it. MY PATHEXT has JS and JSE amoung other things in it. My System Variable QTJAVA still has Files\Java\jre1.5.0_03\lib\ext\QTJava.zip in it.
    Please tell me step-by-step how I can fix this. I never updated these variables before. What do I need to type and where? What do I need to get rid of or change?
    PLEASE HELP!
    Thanks,
    Jim

    I left my System variable classpath --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I left my QT JAVA --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I added Path --> ;C:\j2sdk1.4.2_10\bin and then restarted my computer. I added hello file in C:\j2sdk1.4.2_10\bin and tried to compile it under a new name and it would not compile. it gave me the error below. I was able to compile other java program in my other folder in a different directory. I am still getting the same error messages/ Anything else I should try? IS there anyplace or person I can call who would come and fix this? Something is wrong. This should not be giving me this much trouble. All The Java directions on other websites tell me to do different things. I am so confused... please help.
    I get this during the compilenow:
    javac: invalid flag: C:\j2sdk1.4.2_10\bin\helloa.txt
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are used
    -classpath <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -help Print a synopsis of standard options
    Tool completed with exit code 2
    Jim
    If you can fix this I will give you 14 points. I hope it is enough. I just want this to work for school.

  • Help needed with operating java on other programs

    I have a fairly difficult (I think) question.
    I am trying to create a program to enact itself on other programs.
    It needs to perform 4 functions.
    1) Open an exe (such as notepad)
    2) Use the exe to open another file (such as a .txt)
    3) Find the color of a specific pixel on the screen (ie, (300,800)) and
    4) Pull a number from a field in the program
    I would apprieciate any help on this, whether in the form of an answer, or a url that could help me with it.
    thanks

    you could try shell commands to the dos prompt like:
    try {
         Properties systemProps = System.getProperties();
         String osVersion = systemProps.getProperty("os.name");
         if (osVersion.equals("Windows 98"))     {               
              Runtime.getRuntime().exec("start \"notepad"");
         else if (osVersion.equals("Windows 95"))     {               
              Runtime.getRuntime().exec("start \"notepad"");
         else {  // win nt (2000 or xp)
              Runtime.getRuntime().exec("cmd.exe /c notepad");
         }catch(IOException err) {}Or locate the notepad.exe and use the runtime class to launch it, to open a txt file is exactly the same but substitute the txt file name instead of notepad, that should launch notepad and open the txt in it, if you mean open notepad and then control it and open a file, that java can?t do, need another language to do it or work with another language and java together. Not sure about the rest,

  • Help Needed With A Java Installation

    Hello,
    I'm beyond being a novice with regards to Java. To be quite honest, I don't have the time right now to learn the language, nor do I have the need for anything other than what I am about to ask. I say this upfront to avoid unfriendly comments from people who may criticize my "laziness", NOT to sound disrespectful to those who post or answer questions in this forum.
    With that said, here's my question...
    I have a Sun/Cobalt RaQ4i server. I'd like to run a few free license Java games that I found on a website. The problem is, RaQ appliances do not ship with Java installed. I've been looking for some way to get it on my server for a few days now, with little luck. I've searched the Java help forums, the Sun/Cobalt forums and a few other help sites such as www.raqzone.com. (...which is why laziness is in quotes up there.) I did find this page... "http://developer.cobalt.com/java/java.raq.php". I have now installed both, the package and the update, on the server. However, the applet still does not run. I don't need the JSP feature, as my site is done in ASP. I don't know what a servlet is, but thought it might be similar to an applet, and would do the trick. *?* Apparently, I was wrong. Can ANYONE tell me what I need to do to get the desired results when I try to run a Java applet on my Cobalt RaQ?? I'd also be willing to be a fee to have it installed... correctly, of course! :)
    Thanks in advance for any directions or guidance,
    -Daniel
    [email protected]

    Assuming you're running Solaris, you can download the Java Runtime Environment (JRE) from http://java.sun.com/
    One of the provided programs is appletviewer, which you will be able to use to run applets if they are on your local machine. I'm not entirely sure about Solaris, but the JRE may also install the Java Plugin to your browser so you can view applets in the browser.
    Apologies if this was already mentioned in the link you provided - registration/login is required, so I didn't read it.
    I hope you have more luck with your applets,
    -Troy

  • Help needed with Sun Java Studio Creator and EJB in a Portlet Project

    Hi
    I have created an web-application with JSF in Sun Java Studio Creator 2. The web application uses a lot of EJB's which acts as the dataProviders. In a typical jsp page i have more that one data providers(the EJB's) getting used. When i run the project everything opens up properly in the browser and the application seems to be fine.
    But when i create a JSP 168 Portlet project and do exactly the same thing for some reason the Apache Pluto(comes as the default Portlet Container with Studio Creator) conks off.
    Then i started going ahead step by step:
    1. First i created a portletpage and added only one dataProvider(EJB) and ran the project...It gets deployed properly in Pluto and the browser comes up and everything shows up fine.
    2. Just to re-confirm i did the same thing with another dataProvider(EJB). So still we have just 1 EJB in the portlet page. As expected it also worked fiine.
    3. Then when I added more that one dataProviders(EJBs) in the porlet page the Apache Pluto conks off(saying that Pluto is not available)
    I tried doing a lot of things but nothing works...Surprisingly the same thing works when u create a JSF web Application project but the same thing does not work when u create a JSR 168 JSF Portlet Project...
    Did anybody face the same problem..Is it a bug in the Studio Creator...Any help would be highly appreciated.

    Hi,
    There are a few discussion threads in the feedbackprograms portal for Creator 2 EA 2. The URL is:
    https://feedbackprograms.sun.com/login.html
    In the EA discussion forum you will find threads which discuss the concerned topic. In specific look for threads titled:
    # Deploying Portlets
    # Taking a JSC Portlet to Tomcat creates a Faces Mapping Error
    # Problem with Pluto when trying to deploy a portlet
    # Request: JSR-168 Portlet Project without JSF
    We kindly request you to post your further queries related to EA in the above mentioned forum.
    Cheers
    Giri

  • Still getting java.lang.UnsatisfiedLinkError error for dll

    Hello,
    I get the following error when running an applet with appletviewer:
    java.lang.UnsatisfiedLinkError: C:\java code\KeyStoreApplet\security.dll: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1028)
         at my.security.mymscapi.MySunMSCAPI$1.run(MySunMSCAPI.java:34)
         at java.security.AccessController.doPrivileged(Native Method)
         at my.security.mymscapi.MySunMSCAPI.<clinit>(MySunMSCAPI.java:32)
         at KeyStoreApplet.<init>(KeyStoreApplet.java:256)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at java.lang.Class.newInstance0(Class.java:355)
         at java.lang.Class.newInstance(Class.java:308)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:785)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:714)
         at sun.applet.AppletPanel.run(AppletPanel.java:368)
         at java.lang.Thread.run(Thread.java:619)The error occurs even after downloading VC++ 2008 SP1.
    The applets runs fine on the original machine but not a test machine.
    Any suggestions?
    Thanks.

    That is, after downloading VC++ 2008 SPI redist.

  • Java.lang.UnsatisfiedLinkError with JMatLink under Mac OS X Leopard 10.5.5

    Dear group,
    I'm trying to build and use JMatLink (provides a matlab engine, callable from java) in my Intel Mac running Mac OSX 10.5.5, with Matlab 7.4 (2007a) installed.
    To build the library (libJMatLink.jnilib), I'm using a makefile (see end of post) adapted from one suggested here
    It compiles fine, but some strange things (for me) are happening, with the relative path of the matlab libs
    Leporello:jmatlink miguel$ ldd libJMatLink.so
    libJMatLink.so:
    libJMatLink.so (compatibility version 0.0.0, current version 0.0.0)
    ../../bin/maci/libeng.dylib (compatibility version 0.0.0, current version 0.0.0)
    ../../bin/maci/libmx.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.1)When I try to run a simple example, Zbr.java, in which I call
    System.loadLibrary( "JMatLink" );I constantly get
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /Volumes/Users/miguel/Desktop/JMatLink130/libJMatLink.jnilib:
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1030)
    at Zbr.main(Zbr.java:12)whether I run it
    ${JAVA} Zbr
    ${JAVA} -Djava.library.path=/Users/miguel/Desktop/JMatLink130  Zbror even make a jar with Zbr.class, libJMatLink.jnilib and the jmatlink directory, and put it somewhere else (/Users/miguel)
    ${JAVA} -classpath /Users/miguel/a.jar Zbrwhere
    JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java
    My environment has
    echo $PATH/sw/bin:/sw/sbin:/usr/local/git/bin:/Users/miguel/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin:/usr/texbin:/usr/local/HTS-2.1/bin:/usr/local/SPTK/bin:/opt/local/bin:/Applications/MATLAB74/bin:/Applications/MATLAB74/bin/maci:/usr/X11R6/bin
    echo $DYLD_LIBRARY_PATH/Applications/MATLAB74/bin/maciAs a last curiosity, when I use jdk 1.5 instead of 1.6 to compile and run my example, no exception is thrown!
    I can't figure out whether this is a problem of my settings or the compilation itself...
    I really need this working to continue developing, and any help you could dispense me will be greatly appreciated.
    Miguel
    Makefile:
    CC=gcc-4.0
    LD=gcc-4.0
    # MATLAB
    MATLAB=/Applications/MATLAB74
    CFLAGS = -I$(MATLAB)/extern/include -fno-common -no-cpp-precomp -fexceptions
    CDEBUGFLAGS = -g
    COPTIMFLAGS = -O3 -DNDEBUG
    CLIBS = -L$(MATLAB)/bin/maci -leng -lmx -lstdc++
    arguments = -DMX_COMPAT_32
    LDFLAGS = -O -Wl,-flat_namespace -undefined suppress
    # JAVA
    JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
    JINCLUDE = -I$(JAVA)/include
    libJMatlink.jnilib  : libJMatLink.so
    cp libJMatLink.so libJMatlink.jnilib
    libJMatlink.so  : JMatLink.o
    $(LD) -dynamiclib $(LDFLAGS) $(CLIBS) -o libJMatLink.so JMatLink.o
    JMatLink.o  : JMatLink.c JMatLink.h
    $(CC) $(CFLAGS) $(JINCLUDE) $(MINCLUDE) -c JMatLink.c
    clean:
    rm -f *.o
    rm -f *.so
    rm -f *.class

    Hi jschell, thx for sticking with me on this one :)
    1. You are not creating the library. Did you verify a file with the correct extension exists?
    3. Could also be just a permissions problem.Library is there...and permissions seem ok
    Leporello:JMatLink130 miguel$ ls -l libJMatLink.jnilib
    -rwxr-xr-x  1 miguel  staff  17968  3 Dec 14:46 libJMatLink.jnilibWhich kind of only leaves this possibility...
    2. There is something wrong in the way you created the library. Wrong in such a way that the VM is refusing to find it.I've tried deriving the compilation procedure directly from apple, but problem persists.
    libJMatLink.jnilib: JMatLink.o
         $(LD) -bundle -o libJMatLink.jnilib JMatLink.o -L/Applications/MATLAB74/bin/maci -leng -lmx -lstdc++ -framework JavaVM
    JMatLink.o: JMatLink.c JMatLink.h
         $(CC) -c -I/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Headers -I/Applications/MATLAB74/extern/include JMatLink.cYet again, jdk1.5 is not affected by this.
    You aware of any significant changes to the jni implementation/interface between jdk1.6 and jdk1.5... even if only on the mac side?
    miguel
    Edited by: miguelvaz on Dec 4, 2008 12:08 AM

  • JNI exception, java.lang.UnsatisfiedLinkError

    Hi,
    I�m trying to call a native method with JNI and the following exception occurs when I try to call the native method setFileName:
    Exception occurred during event dispatching:
    java.lang.UnsatisfiedLinkError: setFileName
    The dll where this method is defined is in the directory c:/winnt/system32, the Windows default path.
    Why this exception occurs?
    Thanks in advance
    carlos

    The basic reasons why this would occur are
    1. There is something wrong with the path to the dll.
    2. You didn't do a "loadLibrary()" on the dll before you called the native method.
    3. There is some disconnect between the expected signature of the native method, and the way it is defined in the dll.
    If this doesn't help, thenI suggest you post a bit of code (loadLibrary, native method signature, C function signature).

  • Java.lang.UnsatisfiedLinkError - Urgent please help

    Hi,
    I want to thank you for looking into this problem first.
    I have a very headache problem for the past week. I have an applet that uses JNI to call an existing dll to get the system resources. It works fine on windows 2000 server with IE 5.0. The dll get loaded fine and the function call is working fine.
    However, now I tried to move the applet to an application for me to test with jbuilder, I have problems and I get the error java.lang.UnsatisfiedLinkError: ooInit.
    Does anyone know why this is happening in Jbuilder. I traced to see if the dll get loaded with System.loadlibrary("dll"), and it seems to load the library. But when I call the ooInit() native method, it throws that exception.
    Please help. This will be greatly appreciated and I can do something for you guys in return.
    Thank you so much.
    Regards,
    guna

    Here, for the benefit of others who might search for this, is my approach to resolving this error.
    Two things to note:
    1. I didn't worry about paths, etc. - I was in a hurry so I just copied files into required directories.
    2. I named both the Java and C files "mainFrame". I have not subsequently checked to see if this is required, since it worked for me.
    Summary of getting jni routine to work with Jbuilder:
    created Java project mintest, two principle classes - mainFrame and WelcomeFrame
    key code fragments:
    --------------------------------------- mainFrame --------------------------------------------------
    package mintest;
    import javax.swing.JLabel;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import java.awt.GridBagLayout;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseAdapter;
    public class mainFrame {
        boolean packFrame = false;
        WelcomeFrame frame = new WelcomeFrame();
        public static native int cRoutine(int value);
        static {System.loadLibrary("mainFrame"); }
    public mainFrame() {
        //Pack frames that have useful preferred size info, e.g. from their layout
        //Validate frames that have preset sizes
        if (packFrame) {
          frame.pack();
        else {
          frame.validate();
        // Center the frame
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        if (frameSize.height > screenSize.height) {
          frameSize.height = screenSize.height;
        if (frameSize.width > screenSize.width) {
          frameSize.width = screenSize.width;
        frame.setLocation( (screenSize.width - frameSize.width) / 2,
                          (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
        try {
          jbInit();
        catch (Exception ex) {
          ex.printStackTrace();
    * Main method
    * @param args String[]
    static public void main(String[] args) {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      catch (Exception e) {
        e.printStackTrace();
      new mainFrame();
            cRoutine(1);     // this works at this point...
            System.out.println("cRoutine - should be 4: " + cRoutine(3));
      private void jbInit() throws Exception {
    }--------------------------------------- end of mainFrame --------------------------------------------------
    --------------------------------------- (portions of) WelcomeFrame --------------------------------------
    package mintest;
    import java.awt.*;
    ..... more imports, setting up of window, buttons, etc. .... iValue is an integer....
      public void jToggleButton1_mousePressed(MouseEvent e) {
          jToggleButton1.setText("cRoutine in: " + iValue + "  out: " + (iValue = 
                                   mainFrame.cRoutine(iValue)));
      }--------------------------------------- end of (portions of) WelcomeFrame -----------------------------
    mainFrame was compiled with Jbuilder into a class file, makeFrame.class. That was copied into
    the C:\Borland\JBuilder2005\jdk1.4\bin directory, and javah was run to create the C header file:
    javah -jni mainFrame
    This generated:
    --------------------------------------- mainFrame.h generated by javah ----------------------------------
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class mainFrame */
    #ifndef _Included_mainFrame
    #define _Included_mainFrame
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     mainFrame
    * Method:    cRoutine
    * Signature: (I)I
    JNIEXPORT jint JNICALL Java_mainFrame_cRoutine
      (JNIEnv *, jclass, jint);
    #ifdef __cplusplus
    #endif
    #endif--------------------------------------- end of mainFrame.h generated by javah -------------------------
    OKAY, HERE COMES THE CRITICAL STEP. DESPITE THE FACT THE COMMENT SAYS DO NOT EDIT, THIS FILE HAS TO BE EDITED TO INCLUDE THE PACKAGE NAME, LIKE THIS:
    --------------------------------------- modified mainFrame.h ----------------------------------
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class mainFrame */
    #ifndef _Included_mainFrame
    #define _Included_mainFrame
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     mainFrame
    * Method:    cRoutine
    * Signature: (I)I
    JNIEXPORT jint JNICALL Java_mintest_mainFrame_cRoutine
      (JNIEnv *, jclass, jint);
    #ifdef __cplusplus
    #endif
    #endif--------------------------------------- end of modified mainFrame.h -------------------------
    This file is then copied to the C:\Borland\BCC55\Include directory. The C code source is placed
    in the C:\Borland\BCC55\Bin directory. Here is the C code - note that it has the package name in
    the function name:
    --------------------------------------- mainFrame.c ----------------------------------
    #include <mainFrame.h>
    #include <stdio.h>
    #include <string.h>
    /* must link gpib-32.obj for Windows*/
    #include <windows.h> /*if using Windows */
    void main(){
    JNIEXPORT jint JNICALL
    Java_mintest_mainFrame_cRoutine(JNIEnv *env, jobject callingObj,jint invalue)
    return (jint) invalue+1;
    }--------------------------------------- end of mainFrame.c -------------------------
    This is now compiled on the command line (from the C:\Borland\BCC55\Bin directory) using:
    bcc32 -tWD -I\Borland\bcc55\include -L\Borland\bcc55\lib mainFrame.c
    Parameters: -tWD creates Windows DLL file
    -I is path to include directory (this is where mainFrame.h is located)
    -L is path to library directory
    Compilation produces mainFrame.dll in the C:\Borland\BCC55\Bin directory. This is copied to the C:\Borland\JBuilder2005\jdk1.4\jre\bin directory so Jbuilder can find it. Then it works.
    So, the key step is adding the package name after javah has generated the header file (and similarly using the package name in the .c source file.)
    Hope this is useful.

  • Weblogic server 8.1 JNI module deployment java.lang.UnsatisfiedLinkError

    This is on the weblogic 8.1 Solaris platform.
    We have a module in our application which uses the native shared library and makes JNI called from the J2EE application. We have added the .so files to the LD_LIBRARY_PATH environment variable in our managed server startup scripts. When we start our servers the module works fine. But when we redeploy the J2EE application, the java code is changed but we start getting java.lang.UnsatisfiedLinkError exception when the module is invoked. We are using the staged mode for deployment. We have to shut down the managed servers and restart them every time for this module to start working after the redeployment of the J2EE application.
    Is this a known problem with the JNI based application. Is there any setting that we are missing? Has this problem been fixed in any of the service packs?

    Have you checked to see if your file descriptor setting is set high enough? Disabling native IO is not a very good solution as it will drastically reduce performance.
    --Raheem                                                                                                                                                                                                                                                                                                                                                                   

  • DBCA fails with java.lang.UnsatisfiedLinkError: Can't load library: /u01/oracle/prod/tech_st/product/11.2.0/db_1/oui/lib/linux/liboraInstaller.so Error in Oracle 11g

    Hi,
    After ORACLE 11G software installation i tried to change the ORACLE_HOME directory.
    OS : RHEL 4.5
    DB : 11.2.0
    Previous Home Location :
    [oracle@localhost ~]$ echo $ORACLE_HOME
    /u01/oracle/prod/tech_st/product/11.2.0/db_1
    Current Home Loc:
    [oracle@localhost ~]$ echo $ORACLE_HOME
    /u01/oracle/db/tech_st/product/11.2.0/db_1
    When i am trying the DBCA command i am getting the below error:
    [oracle@localhost ~]$ dbca
    java.lang.UnsatisfiedLinkError: Can't load library: /u01/oracle/prod/tech_st/product/11.2.0/db_1/oui/lib/linux/liboraInstaller.so
            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1650)
            at java.lang.Runtime.load0(Runtime.java:769)
            at java.lang.System.load(System.java:968)
            at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.loadNativeLib(OiipuUnixOps.java:387)
            at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.<clinit>(OiipuUnixOps.java:122)
            at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.getEnv(OiipgEnvironment.java:201)
            at oracle.sysman.oii.oiip.oiipg.OiipgPropertyLoader.initUnixPtrFileLoc(OiipgPropertyLoader.java:212)
            at oracle.sysman.oii.oiip.oiipg.OiipgPropertyLoader.<clinit>(OiipgPropertyLoader.java:125)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.updateProperties(OiicStandardInventorySession.java:492)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:266)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:240)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:189)
            at oracle.sysman.assistants.util.InventoryUtil.getOUIInvSession(InventoryUtil.java:346)
            at oracle.sysman.assistants.util.InventoryUtil.getHomeName(InventoryUtil.java:87)
            at oracle.sysman.assistants.util.OracleHome.getInventoryHomeName(OracleHome.java:1023)
            at oracle.sysman.assistants.dbca.backend.Host.<init>(Host.java:798)
            at oracle.sysman.assistants.dbca.ui.UIHost.<init>(UIHost.java:257)
            at oracle.sysman.assistants.dbca.ui.InteractiveHost.<init>(InteractiveHost.java:54)
            at oracle.sysman.assistants.dbca.Dbca.getHost(Dbca.java:164)
            at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:112)
            at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:184)
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no oraInstaller in java.library.path
            at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
            at java.lang.Runtime.loadLibrary0(Runtime.java:822)
            at java.lang.System.loadLibrary(System.java:993)
            at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.loadNativeLib(OiipuUnixOps.java:405)
            at oracle.sysman.oii.oiip.osd.unix.OiipuUnixOps.<clinit>(OiipuUnixOps.java:122)
            at oracle.sysman.oii.oiip.oiipg.OiipgEnvironment.getEnv(OiipgEnvironment.java:201)
            at oracle.sysman.oii.oiip.oiipg.OiipgPropertyLoader.initUnixPtrFileLoc(OiipgPropertyLoader.java:212)
            at oracle.sysman.oii.oiip.oiipg.OiipgPropertyLoader.<clinit>(OiipgPropertyLoader.java:125)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.updateProperties(OiicStandardInventorySession.java:492)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:266)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:240)
            at oracle.sysman.oii.oiic.OiicStandardInventorySession.initSession(OiicStandardInventorySession.java:189)
            at oracle.sysman.assistants.util.InventoryUtil.getOUIInvSession(InventoryUtil.java:346)
            at oracle.sysman.assistants.util.InventoryUtil.getHomeName(InventoryUtil.java:87)
            at oracle.sysman.assistants.util.OracleHome.getInventoryHomeName(OracleHome.java:1023)
            at oracle.sysman.assistants.dbca.backend.Host.<init>(Host.java:798)
            at oracle.sysman.assistants.dbca.ui.UIHost.<init>(UIHost.java:257)
            at oracle.sysman.assistants.dbca.ui.InteractiveHost.<init>(InteractiveHost.java:54)
            at oracle.sysman.assistants.dbca.Dbca.getHost(Dbca.java:164)
            at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:112)
            at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:184)
    [oracle@localhost ~]$
    I tried all possible ways with google help but still i am facing the same issue.Kindly check and suggest to solve the issue.
    Thanks in advance.
    Vijay.

    Hi all,
    I give you the clear details about the issue what i am currently facing,
    1. I installed the 11g (11.2.0) database alone(No EBS) in my local vmware machine.
    2. Created my ORACLE_HOME under /u01/oracle/prod/tech_st/product/11.2.0/db_1 directory after that i tried to change my home location from /u01/oracle/prod/tech_st/product/11.2.0/db_1 location to /u01/oracle/db/tech_st/product/11.2.0/db_1 location, like created /u01/oracle/db directory and moved files from /u01/oracle/prod location.
    3. I changed my bash_profile and exported home with the modified location also deregistered an old home and registered the new home.
    4. When i am issuing echo $ORACLE_HOME it is showing the current home location and ORACLE_SID is same what i created before.
    5. But when i am trying to create one more db using DBCA utility it is through the above error.
    Please suggest me is it possible to change the location after db creation or any extra steps i have to do for this issue.
    Thanks.

  • "Exception in thread "main" java.lang.UnsatisfiedLinkError:"  JNI in Linux

    Hi,
    I am writing a simple program to understand how JNI works so that I can use this concept to develop a project. But after running the simple code,
    It gives the following error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: sum
    at TestJni.main(testJni.java:25)
    My Java code is:
    import java.io.*;
    import java.util.*;
    class TestJni
    // Try to load the native Code library for user Authentication.
    static
    try
    System.loadLibrary( "test" );
    catch( UnsatisfiedLinkError e )
    System.out.println("Could not load native code for user authentication." );
    System.exit(1);
    public static void main( String [] args )
    //TestJni obj = new TestJni();
    System.out.println(TestJni.sum(2, 3));
    public static native int sum( int x, int y );
    TestJni.h looks like:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class TestJni */
    #ifndef IncludedTestJni
    #define IncludedTestJni
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: TestJni
    * Method: sum
    * Signature: (II)I
    JNIEXPORT jint JNICALL Java_TestJni_sum
    (JNIEnv *, jclass, jint, jint);
    #ifdef __cplusplus
    #endif
    #endif
    and my C++ code is:
    #include <jni.h>
    #include "TestJni.h"
    #include <stdio.h>
    JNIEXPORT jint JNICALL Java_TestJni_sum(JNIEnv *env, jclass obj, jint x, jint y)
    printf("Inside the native function\n");
    return (x + y);
    Then I am generating my .so file as:
    g++ -o libtest.so sum.cpp -shared -fpic -lcrypt -I//usr/lib/j2se/1.4/include -I/usr/lib/j2se/1.4/include/linux
    and copying the libtest.so file into the folder where I have my TestJni.class file. Then running the java code by:
    java TestJni
    but it gives the "UnsatisfiedLinkError". What to do? :( I have spend 2 days now to solve this problem but I am not getting it.
    I am using ubuntu 7.10 as my OS.
    Please let me know if you can help.

    Thanks for your response. I found that, when I copied the shared library to /usr/lib and
    did: ldconfig -n /usr/lib it worked
    But the problem is, this is my computer, but the computers that I am going to run my actual
    JNI application, have restrictive permission. Could anyone please let me know how I can
    do the work without ldconfig. I mean is there anyway I can configure my .so file's path without
    copying it into the /usr/lib folder and without ldconfig?
    I will appreciate any reply. Thanks.

  • [Help] Another java.lang.UnsatisfiedLinkError: no ocijdbc9

    Hi All,
    I just learnt how about Oracle. Then, now I need to use JDBC driver.
    I am using Oracle 8i.
    I tried to follow the instruction in here.
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc817.html
    Then, I tried the basic sample provided there.
    But that give me the following error.
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.l
    ibrary.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:300)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:361)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:485)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:337)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcCheckup.main(JdbcCheckup.java:42)
    Can anybody tell me why? what's wrong with it?
    Moreover, I am wondering why it says no ocijdbc9, while I am using Oracle 8i.
    Could anybody explain please ...

    I suspect that you are using the oracle oci driver. That driver requires a n Oracle client installation on the machine which would be establishing connection. Moer specifically, it makes use of the native library ocijdbc9.dll and the directory containing it [if the installation has been done] should be present in the Path in environment variables.

Maybe you are looking for

  • New GL and Profit center settings

    hi, i've already tried to find out this on other thread, but with no reply - so i am asking again - does anyone know the correct connection/explanation for the issue below? "2) Profit Center Integration - With the new GL, Profit Center Accounting is

  • SPDIF passthrough with Audigy SE and Digital I/O Car

    Does anyone have this working or know if its possible with Vista 32bit's?Comparing my pc (built-in soundcard) with my new PC that has the Audigy, it looks like there are some tabs missing in Control Panel in the Playback->Digital Output Device screen

  • Battling Hardware MPE, Episode 2: Chunky Blurs

    Round Two of my hardware acceleration MPE tests... When using direct export with hardware MPE, any effect that renders a blurred alpha channel (Fast Blur, Gaussian Blur, etc.) creates an extremely ugly/chunky/unusable result. The source footage and s

  • How to delete Guest User Account

    I just got my Mac book Pro and I'm new to Mac. I created a Guest User Account and now I want to delete it. But the - (minus) option is grey out. How can I delete the Guest User Account? I have two accounts listed right now. The Admin and the Guest Ac

  • Problems to sync after Upgrade Touch 4G

    Hi folks, right after upgrade my Ipod Touch 4G to iOS 5 I experience major problem with syncing my IPod with ITunes (Also updated) In most tries Itunes tells me that it cannot connect properly with the IPod and I need to restore it. This happens with