Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Dear community,
I wrote a OTK-Java-free application which runs fine on my developing environment. I am having problems to get the app working on client machines though.
One basic question: Is it possible to run this java-app without Java Object-Toolkit installation on the client machine? If so, how do I link to otk.jar?
I tried to link to the manually copied jar file in severals ways without success:
via config.pro option: jlink_java_command [path-to-folder]\java.exe -cp [path-to-folder]\otk.jar
via creotk.dat option: JAVA_APP_CLASSPATH [path-to-folder]\MyApp.jar;[path-to-folder]\otk.jar
I appreciate your help!
Best regards
Michael
Hi,
you can test my uploaded example.
Once you unzip file, you have to modify protk.dat and Creo 5.0.2.0.bat.
Note: D:\Java\jdk64\jre\bin\java.exe ... java version "1.8.0_231"
Hello Martin,
thank you very much for your answer!
I did not test your example but I see how you link to otk.jar: by setting the classpath variable in the startup batch file. This should work, I believe! But I want to avoid altering the startup precedure on the client machines.
This is why I am trying to change the classpath either in the config.pro or the creotk.dat. I also tried a third option: linking to otk.jar inside my jar file via MANIFEST.MF
I just managed to get it running with setting the config.pro option to
jlink_java_command [path]\java.exe -cp [path]\otk.jar
This is second best, because inside config.pro I only want to link to the creotk.dat, e. g.
toolkit_registry_file [path]\creotk.dat
(I want to avoid that the user has to deal with internals like java classpaths).
So the best thing would be to set the classpath either in creotk.dat or the MANIFEST.MF file of my jar application.
Do you have any idea how to do so?
Best regards
Michael
@MichelH wrote:
Hello Martin,
thank you very much for your answer!
I did not test your example but I see how you link to otk.jar: by setting the classpath variable in the startup batch file. This should work, I believe! But I want to avoid altering the startup precedure on the client machines.
This is why I am trying to change the classpath either in the config.pro or the creotk.dat. I also tried a third option: linking to otk.jar inside my jar file via MANIFEST.MF
I just managed to get it running with setting the config.pro option to
jlink_java_command [path]\java.exe -cp [path]\otk.jar
This is second best, because inside config.pro I only want to link to the creotk.dat, e. g.
toolkit_registry_file [path]\creotk.dat
(I want to avoid that the user has to deal with internals like java classpaths).
So the best thing would be to set the classpath either in creotk.dat or the MANIFEST.MF file of my jar application.
Do you have any idea how to do so?
Best regards
Michael
Hi,
I asked Google ... protk.dat java_app_classpath site:ptc.com
In result list I found https://community.ptc.com/t5/Customization/JLink-adding-external-libraries-to-classpath/td-p/374767 discussion. It contains following information:
in the meantime I figured a rather strange looking syntax for the protk.dat by dividing two libs with a ".;"
java_app_classpath /apps/lib1.jar.;./apps/lib2.jar
So I removed CLASSPATH definition from Creo 5.0.2.0.bat and modified protk.dat (see attachment):
java_app_classpath D:\users\mh\creo5_parametric\PTC_JLink\install_test_05.;.E:\PTC\Creo5_020\Creo 5.0.2.0\Common Files\text\java\otk.jar
Hi Martin,
thanks again!
unfortunately it didn't really work on my machine. For one thing I realized that there seems to be a different behaviour between creotk.dat and protk.dat. First nothing really worked in my creotk.dat but when I switched to protk.dat it seemed to work with a ".;." in-between the two jar-files (I think since the "." is usually used for relative paths and is here followed by a full path it is simply ignored - just a guess).
But I realized that Creo just used the otk.jar that I set during test in the config.pro via "add_java_class_path" (I renamed the "hard coded" otk.jar in installation path ..\text\java\ for testing to make sure Creo doesn't access it). So maybe the same happened on your computer or I don't know what's different on my machine.
BTW, I realized only when I load a jlink app Creo set's the CLASSPATH to the installation path's otk.jar (..\text\java\). Do you know how I can disable this behaviour?
Best regards
Michael
Hi,
I am little bit confused with your reply.
unfortunately it didn't really work on my machine.
This info is useless.
For one thing I realized that there seems to be a different behaviour between creotk.dat and protk.dat. First nothing really worked in my creotk.dat but when I switched to protk.dat it seemed to work with a ".;." in-between the two jar-files (I think since the "." is usually used for relative paths and is here followed by a full path it is simply ignored - just a guess).
I use protk.dat file only (in combination with PROTKDAT config.pro option). I don't care about creotk.dat.
But I realized that Creo just used the otk.jar that I set during test in the config.pro via "add_java_class_path" (I renamed the "hard coded" otk.jar in installation path ..\text\java\ for testing to make sure Creo doesn't access it). So maybe the same happened on your computer or I don't know what's different on my machine.
My config.pro file does not contains add_java_class_path option.
BTW, I realized only when I load a jlink app Creo set's the CLASSPATH to the installation path's otk.jar (..\text\java\). Do you know how I can disable this behaviour?
How did you find out?
Hello Martin,
sorry for my misunderstandable message.
I found out about the java classpath in CREO by opening the internal system window (Open System Window) and typing:
set java_home
Does it only show only one or several paths on your machine?
Best regards
Michael
@MichelH wrote:
Hello Martin,
sorry for my misunderstandable message.
I found out about the java classpath in CREO by opening the internal system window (Open System Window) and typing:
set java_home
Does it only show only one or several paths on your machine?
Best regards
Michael
Hi,
I do not have java_home environment variable defined in my Windows OS.
set java_home command returns error message Environment variable java_home not defined
Hi Martin,
did you lauch the command window from inside CREO? Because the environment variables diver to those of the Windows OS.
BR
Michael
@MichelH wrote:
Hi Martin,
did you lauch the command window from inside CREO? Because the environment variables diver to those of the Windows OS.
BR
Michael
Yes .... of course ... I did it.
Ah, sorry, I mixed up the variable. Could you please check the following?
set CLASSPATH
@MichelH wrote:
Ah, sorry, I mixed up the variable. Could you please check the following?
set CLASSPATH
Hi,
Creo adds CLASSPATH variable when it starts JLink application via protk.dat file.
It looks like user running JLink application must have Creo+JLink installed - see below.
PDF manual is attached.