background preloader

J-link

Facebook Twitter

Compile Your Pro/ENGINEER Java Application with Intralink! If you've wanted to try some Pro/ENGINEER programming using J-Link (the free Java API), but didn't know how to compile your program, then this article is for you.

Compile Your Pro/ENGINEER Java Application with Intralink!

Forget Netbeans, forget Eclipse, and forget downloading and installing the JDK. Just use Intralink's Java Runtime Environment to compile your apps. Seriously though, those IDE's are really great programs, but sometimes you can't install them, or they're not available on your system, or you just need something minimal and fast. Fortunately, Intralink contains everything we need to compile J-Link applications: a JRE and tools.jar. tools.jar is the codebase from Javasoft that contains Java compilation code. Here is a batch file that will compile J-Link Java code on Windows: @echo offrem jlink_javac.bat - Compile JLink Apps using Intralink JDK. Creating Pro/ENGINEER Trail Files in Java. If you're trying to automate some Pro/ENGINEER activity, the use of trail files is a solid and reliable method.

Creating Pro/ENGINEER Trail Files in Java

Whether you are trying to automate interference checks, convert files to ProductView or PDF, or just verify a large number of family tables, trail files work great. This is assuming that you don't need any interaction between Intralink and Pro/ENGINEER, during the trail file execution. The first thing you need is a trail file template. This is simply a trail file that you have recorded. The content will be changed slightly to include variable names where real values will be substituted at runtime. For example, this:~ Activate `main_dlg_cur` `ProCmdModelOpen.file`~ Select `file_open` `Ph_list.Filelist` \1 `abc.prt`Becomes this:~ Activate `main_dlg_cur` `ProCmdModelOpen.file`~ Select `file_open` `Ph_list.Filelist` \1 `@NAME@` One thing to note about trail files, they contain a lot of "fluff", which are lines that you don't need, but got recorded. !

Getting Started with Java and Pro/Engineer, Part 2. J-Link Java Code Requirements J-Link requires that you have static methods with names matching the java_app_start and java_app_stop options from the registry file.

Getting Started with Java and Pro/Engineer, Part 2

Using the example registry file from Part 1, the required signatures for the "start" and "stop" methods would look like this: public static void startApp(); public static void stopApp(); As you'll see from the code that follows, these static methods don't do much but call other methods where all the important stuff happens.

This approach seems to work well, but there are certainly other ways to approach J-Link. Method Summary: Here are the other methods used by the program, none of which are static: Constructor JLinkHelloWorld() The constructor sets up the needed utility items, such as the program name (based on the class name), a FileWriter object for the log file, and the platform specific newline character. Getting Started with Java and Pro/Engineer, Part 1. J-Link can seem intimidating at first, but once you have all the little pieces in hand to get started, it's actually pretty simple.

Getting Started with Java and Pro/Engineer, Part 1

In this article, I'll walk you through all the pieces that you need to create a basic J-Link application. Even a simplistic J-Link program requires several files, including your Java code compiled to class file(s), a text-based "message file", and an auxiliary application "registry file". I'll explain the required content of each file and how to put them all together. The Registry File The registry file is used to instruct Pro/Engineer on how to load an auxiliary application, such as a Pro/Toolkit or J-Link program. An auxiliary application can be started by Pro/Engineer automatically by using the PROTKDAT config.pro option, or by placing the registry file in certain special locations (i.e. the working directory, within the Pro/Engineer install, etc). Java - Debugging a JLink application in Pro-Engineer.