Skip to main content


2 replies [Last post]
Joined: 2009-01-06

This is probably the wrong forum to post java questions, but I am very new to the Java world and have no idea where to post such a question. I looked around and could not find a more suitable place to post If this is the wrong place, could someone please point me in the right direction? Thanks!

As for the problem:

I have inherited a project written in Java (using netbeans as an IDE) that contains a call to a native function. My understanding is that this is called from a shared library file - written in C++. The library seems to load correctly, but the function call throws an UnsatisfiedLinkError.

Interestingly, this code has worked in the past on another computer (since reformatted and not reloaded as of yet), but does not work on this one. That makes me think it's an environment or a compiler issue. Based on my limited java debugging skills, I have tried ldd (which shows no missing dependencies) and objdump -a which returns 'file format elf64-x86-64' for the .so and 'File format not recognized' for the binary :-/

I can understand if no one would be able to help since this code was all written in house, but google searches have been of no help, and I'm not sure where else to turn.

A little more info now:

Stack Trace =

java.lang.UnsatisfiedLinkError: netvis.interdml.DMLNativeInterface.LoadDML([Ljava/lang/String;Ljava/util/LinkedList;)Lnetvis/dml/Node;
at netvis.interdml.DMLNativeInterface.LoadDML(Native Method)
at netvis.Project.parse(
at netvis.ui.MainForm.createProject(
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Call from java side that throws the exception:

<br />
	      try {<br />
//This line--->	         netvis.dml.Node nodeTree = DMLNativeInterface.LoadDML(filePaths,log);<br />
	         objectTree = new TopLevel(nodeTree);<br />
            for (String s : log) System.out.println(s);<br />
	      } catch (UnsatisfiedLinkError e)<br />
              {<br />
                e.printStackTrace();<br />
              }<br />
              catch (Exception e) {<br />
                e.printStackTrace();<br />

Definition in java:

public static native netvis.dml.Node LoadDML(String [] files, LinkedList log);

Definition in c++ library source code:

<br />
// DMLNativeInterface.LoadDML method<br />
//extern "C"{<br />
JNIEXPORT jobject JNICALL Java_netvis_interdml_DMLNativeInterface_LoadDML<br />
  (JNIEnv * env, jclass theClass, jobjectArray stringArray, jobject outList)<br />
{<br />

I've tried making it extern "C" to no avail.

Thanks! Any help is appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-11-01

Welcome to the Sun fora.
The forum topics on are rather specific to the development of Java itself.
A forum which may be useful in future is the "New to Java" forum

However for this specific problem

Your UnsatifiedLinkError is likely due to failing to load a shared library which your application references. This could be because the directory it is in is not in your LD_LIBRARY_PATH or the library was not compiled for the platform of your new machine.

If you don't get much help here, you can post on a second forum, but make it clear this is what you are doing and place a link from one posting to the other.

Joined: 2009-01-06

Thank you for the welcome, the help, and the redirection. I didn't think this was the right place to go, but wasn't sure where would be better.

As for my problem, I am starting to think you are in right in that it is not recompiling properly on my new machine. However, I am not sure why not as of yet.

For anyone interested in following this discussion, here is the thread I started on