Purpose of writing this article
UGS has released NXOpen for Java, which can be developed in Java.
How to build an NXOpen for Java development environment for ease of use?
The specific goal is to compile an existing source code file and then execute it in the NX software environment.
Body
It can be built based on the previous article. In fact, the most important thing is to tell the compiler where the NXOpen for Java class library is located. Specifically, NXOpen. jar and NXOpenUF. jar. So you can modify the java-path.bat content, as shown below.
//////////////////////////////////////// /Nxopen-java.bat ////////////////////////////////////// /////
@ Echo off
Rem sets Java environment variables to facilitate Java programming
Set JAVA_HOME = C: \ Program Files \ Java \ jdk1.6.0 _ 21
Set Path = % JAVA_HOME % \ bin; % JAVA_HOME % \ .. \ jre6 \ bin; % Path %
Set CLASSPATH =.; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar
Set NXOPENJARDIR = % UGII_ROOT_DIR %
Set CLASSPATH = % NXOPENJARDIR %/NXOpen. jar; % NXOPENJARDIR %/NXOpenUF. jar; % CLASSPATH %
Echo on
//// // This file is complete
The shortcut settings are the same as those above.
Now we can officially use Java for the second development of NX.
Test execution
However, during the compilation and execution process, I found that NX 4.0 could not run normally. The running result is as follows:
Result of nxopen for Java program running in NX 4.0
Fortunately, it can be run under NX 6.0.
As to why NX 4.0 cannot run, it is estimated that it is related to the version or registration license, and how to set it to run is not what I can do. Now, I can say that my goal has been achieved.