Showing results for 
Search instead for 
Do you mean 

NX Open using Java Exception error

Hi everybody!


I am running and automation of an FEA in NX using Java through Eclipse. The external connection from eclipse to NX is via the Licensing example of NX Open.

Last week my computer broke down and I needed to reinstall Windows and all the software again. I had the workspace saved, but now when I run the Main class the following error appear:


java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at nxopen.SessionFactory.get(Unknown Source)
at nxopen.SessionFactory.get(Unknown Source)
at Main$
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$ Source)
at java.awt.EventQueue$ Source)
at Method)
at$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
... 17 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Program Files\Siemens\NX 9.0\UGII\libnxopenjavacore.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at nxopen.SignJarCore.loadLibraryCore(Unknown Source)
at nxopen.BaseSession_impl.initialize(Unknown Source)
at nxopen.Session_impl.initialize(Unknown Source)
at nxopen.BaseSession_impl.<init>(Unknown Source)
at nxopen.Session_impl.<init>(Unknown Source)
at nxopen.Session_impl.GetSession(Unknown Source)
... 21 more


I do not know too much about the library references and how to relate them.


Thank you so much for the help






Re: NX Open using Java Exception error

Hi Bernardo,

You have to add the external NXOpen jars to your Eclipse project. The steps are the same for other external jars, therefore, internet search gives some detailed documentation on this.

As there are different solutions I recommend the following steps:

1. In Eclipse go to Window -> Preferences -> Java -> Build Path -> User Libraries  and add a new user library


2. Go to your project, RMB -> Build Path -> Configure Build Path

3. Go to the Library Tab and Add Library and select User Library. Here select the user library created in step 1.



4. Finally the NXOpen jars should now be available in your project


Hope this helps.


Re: NX Open using Java Exception error

I am getting same error though I have added external Jar to it.
But Here I m running standalone code for NX .Not integrated with soa code .

Re: NX Open using Java Exception error

I have the same problem. I add all NXOpen jar files to my eclipse project and I add the UGII directory to java.library.path however when I run the java program get an error.


libnxopenjavacore.dll: Can't find dependent libraries

Do I need to add more folders to java.library.path? I don't found any page about configuration of java projects to uses NXOpen libraries.

Re: NX Open using Java Exception error

Have you added the UGII directory to the Windows path variable?

Re: NX Open using Java Exception error

Yes, I have UGII in windows PATH variable. Do I need others folders in PATH variable or another environment variables?

Re: NX Open using Java Exception error

See Compiling and linking NX Open for Java in the NX Open Programmer's Guide in the online help.

Re: NX Open using Java Exception error

I read guide and I have all JAR files in my project classpath (eclipse).


Can someone make a summary about all I need for using NXOpen in my java project?


I have this configuration:


- Java project in Eclipse.

- All NXOpen JAR files in my project classpath.

- UGII folder in windows PATH variable.


One question:


Do I need that NX is running to execute unit test or main method? I have this code for test this problem:


 * Main method.
 * @param args
 * @throws NXException
public static void main(String[] args) throws NXException {



Thanks and best regards.

Re: NX Open using Java Exception error

I don't see that anything else must be defined in Eclipse.

Something like this is more reasonable to test the set-up:


ufSession = (UFSession)SessionFactory.get("UFSession");



It should give you something like NX



Re: NX Open using Java Exception error

Hallo, if you even have the Problem, you can use an old Java version. lastly you can also windows newly install. i solved the same of problem with that.

there are conflicts in your configurations.