cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Getting Started with OTK Java Free

Chris_Johnson
14-Alexandrite

Getting Started with OTK Java Free

Hi All,

 

I’m trying to get to grips with the OTK Java Free toolkit to create a fairly simple tool to just output the top level assemblies from an assembly as STEP files. However, I can’t even get the sample code from the Creo install to work, including the install test  -which randomly requires a deprecated config.pro option that pops up a warning about needing a code to enable it. 

Does anyone have some good tutorials on getting a simple OTK Java free (formerly J-Link) program to work. Even just a hello world example? 
Thanks in advance. 

ACCEPTED SOLUTION

Accepted Solutions

Hi Martin,

 

Thank you for this, it has been very helpful. I actually managed to solve my issue eventually. I realised that I had missed a / from my protk.dat, so my text folder said C:ptc/<app name>/text instead of C:/ptc/<app name>/ 

 

I asked tech support about it and they spotted it almost immediately. It's amazing how you just can't see things right in front of you at times!

 

Thanks again for your help.

 

Chris

View solution in original post

8 REPLIES 8

Have you explored all these tech articles?

https://www.ptc.com/en/support/article/CS76124 

 

3rd party information:

http://missingmanuals.blogspot.com/ 

http://inversionconsulting.blogspot.com/2009/06/proe-java-jlink-getting-started-2.html 

 

If you need a solution fast and want to retain a consultant for training or to create your apps then check this vendor:

https://www.felcosolutions.com/ 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric
Chris_Johnson
14-Alexandrite
(To:tbraxton)

Thank you, this has got me started, I set everything up using the instructions from your second link and it all compiled and I could link it to Creo.

 

However, I now get an error about licensing, but from what I can tell the code doesn't call any of the prohibited classes in the otk.jar file. I used this article for reference: Article - CS188737 - What are the differences between J-Link and Object Toolkit Java API in Creo Parametric ? (ptc.com) Any ideas what is causing this?

 

Thanks again.


@Chris_Johnson wrote:

Thank you, this has got me started, I set everything up using the instructions from your second link and it all compiled and I could link it to Creo.

 

However, I now get an error about licensing, but from what I can tell the code doesn't call any of the prohibited classes in the otk.jar file. I used this article for reference: Article - CS188737 - What are the differences between J-Link and Object Toolkit Java API in Creo Parametric ? (ptc.com) Any ideas what is causing this?

 

Thanks again.


Hi,

simply check whether your code imports or refers to WFC or UIFC classes (taken from CS188737).


Martin Hanák

Thanks Martin, it doesn't, but I found that changing the protk.dat file to read "startup java" instead of "startup OTK_java", as suggested in the getting started guide has allowed the program to run without the license dialogue.

 

I still have the problem that the install test application is written to use deprecated classes and therefore doesn't show the required menu buttons. Creo seems to be happy to start it up though, it just doesn't do anything. The application example in @tbraxton links doesn't work though. It compiles just fine but won't start. 


@Chris_Johnson wrote:

Thanks Martin, it doesn't, but I found that changing the protk.dat file to read "startup java" instead of "startup OTK_java", as suggested in the getting started guide has allowed the program to run without the license dialogue.

 

I still have the problem that the install test application is written to use deprecated classes and therefore doesn't show the required menu buttons. Creo seems to be happy to start it up though, it just doesn't do anything. The application example in @tbraxton links doesn't work though. It compiles just fine but won't start. 


Hi,

1.] Please upload java source code of install test application (I suggest to pack it into zip file).

2.] What Creo version do you use ?

3.] Please open https://www.ptc.com/en/support/article/CS323327

       and read How to regenerate Solid in Creo JAVA OTK & VB API ? paragraph.

 


Martin Hanák

Thanks @MartinHanak ,

 

1. I have uploaded the application, as supplied in the Creo 8.0.6.0 install directory, with the small exception that I've updated protk.dat to show the path that I've saved it in. I have also compiled the application using Amazon Coretto 11's  javac compiler. JAVA_HOME is set to the JVM for the same version of Java.

 

2. Creo Version is 8.0.6.0

 

3. This makes sense, thank you. I did search the knowledgebase, but didn't see that. So it seems the deprecated config.pro option is no longer required. 

 

Thanks again for the help. From what I can tell, the button is created, but I just can't see it anywhere because the tools menu that used to be present in Creo is no longer there in Creo 8. The message "Application "InstallTest" started successfully." does show correctly in the message bar at the bottom of the screen, so it all seems to be working, although line 28 of StartInstallTest.java would suggest another message should be displayed saying "Started", which I don't see.


@Chris_Johnson wrote:

Thanks @MartinHanak ,

 

1. I have uploaded the application, as supplied in the Creo 8.0.6.0 install directory, with the small exception that I've updated protk.dat to show the path that I've saved it in. I have also compiled the application using Amazon Coretto 11's  javac compiler. JAVA_HOME is set to the JVM for the same version of Java.

 

2. Creo Version is 8.0.6.0

 

3. This makes sense, thank you. I did search the knowledgebase, but didn't see that. So it seems the deprecated config.pro option is no longer required. 

 

Thanks again for the help. From what I can tell, the button is created, but I just can't see it anywhere because the tools menu that used to be present in Creo is no longer there in Creo 8. The message "Application "InstallTest" started successfully." does show correctly in the message bar at the bottom of the screen, so it all seems to be working, although line 28 of StartInstallTest.java would suggest another message should be displayed saying "Started", which I don't see.


Hi,

to point 1 ... difference between your code (left side) and my code (right side). I can't remember why I commented status command.

MartinHanak_0-1675330026716.png

 


Martin Hanák

Hi Martin,

 

Thank you for this, it has been very helpful. I actually managed to solve my issue eventually. I realised that I had missed a / from my protk.dat, so my text folder said C:ptc/<app name>/text instead of C:/ptc/<app name>/ 

 

I asked tech support about it and they spotted it almost immediately. It's amazing how you just can't see things right in front of you at times!

 

Thanks again for your help.

 

Chris

Announcements


Top Tags