Cancel
Showing results for 
Search instead for 
Did you mean: 

.jar file locked once executed

Creator
Creator

Hi there,

once I execute a .jar file in NX I need to close NX so I am able to delete the .jar file and build a new one, although the process has ended. Is there a way to keep the NX session open, execute a .jar, buid a new one, execute again and so on ? 

4 REPLIES

Re: .jar file locked once executed

Siemens Phenom Siemens Phenom
Siemens Phenom

See nxopen.BaseSession.LibraryUnloadOption:

public static class BaseSession.LibraryUnloadOption

 

  • Describes when an automation program should be unloaded from a running session. To use the enum, implement a public static function called getUnloadOption which returns one of these options as an integer. The getUnloadOption must be in the same class that contains your main method, and the function should have no parameters. NX will call this method once the automation program has exited to determine when to unload the library. When a java automation program is unloaded the licenses acquired by the program are released and garbage collection is performed.

 

 

Re: .jar file locked once executed

Honored Contributor
Honored Contributor

This should be controlled by the "Unload Option" that you have specified. In the .net languages, you define a "GetUnloadOption" function and in that function specify which unload option to use. I have not programmed NX with Java, but I imagine the process is similar.

 

VB.net example code:

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

        '----Other unload options-------
        'Unloads the image when the NX session terminates
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

Re: .jar file locked once executed

Creator
Creator
I had the getUnloadOption function implemented, but not in my main class. That was the reason it did not work. Now it works just great ! Thank you.

Re: .jar file locked once executed

Esteemed Contributor
Esteemed Contributor

NOTE:

There are a (very) few calls that prevent a function from being unloaded immediately.

Typically they are ones that register other functions/calls/callbacks.

 

Ken

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled