Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
package creodemo;
import java.io.BufferedWriter;
import java.io.FileWriter;
import com.ptc.pfc.pfcGlobal.pfcGlobal;
import com.ptc.pfc.pfcSession.Session;
import com.ptc.wfc.wfcSession.WSession;
public class CreoCustomCodeDemo {
private Session session;
private WSession wSession;
public static void start() {
System.out.println("Custom Code : Started");
new CreoCustomCodeDemo();
}
public CreoCustomCodeDemo() {
this.getSession();
}
private void getSession() {
try {
FileWriter fileWriter = new FileWriter("CreoOutput.txt");
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write("We are in Session");
session = pfcGlobal.GetProESession ();
wSession = (WSession)session;
System.out.println(wSession.GetActiveModel().GetCommonName());
bufferedWriter.write(wSession.GetActiveModel().GetCommonName());
System.out.println(wSession.GetActiveServer().GetContext());
bufferedWriter.write(wSession.GetActiveServer().GetContext());
bufferedWriter.write("We are out of Session");
bufferedWriter.close();
} catch (Exception e) {
System.out.println("An Error occured while accessing Session Information" + e.getMessage());
e.printStackTrace();
}
}
public static void stop() {
System.out.println("Custom Code : Stopped");
}
}
We are using the above class as a custom application using PTC Creo Object TOOLKIT java, and just trying to figure out how we could leverage the features of CREO to extend it's functionality.
We performed the steps as described in the manual for the toolkit, and after we had created the jar for the class file with the above code, we created the registry file 'creotk.dat' with the following content
name CreoCustomCodeDemo
startup otk_java
toolkit object
creo_type parametric
java_app_classpath ./creocustomcodedemo.jar
java_app_class creodemo.CreoCustomCodeDemo
java_app_start start
java_app_stop stop
allow_stop true
delay_start false
text_dir ./text
end
and as described in the user guide we are trying to run this application as a stand alone application, using the Creo Parametric's Auxiliary Applications window to register and start this application.
But after registering the application when we try and start the application, we get the error 'Startup of application "CreoCustomCodeDemo" failed.'
We are using Creo 3.0 with datecode M010 and the application that we are using had been compiled with jdk 1.7.0_60.
Could anyone point out where we may be doing something wrong, or are we missing any step?
Hi,
try to use absolute paths in line no. 5 and 11 in creotk.dat instead of relative ones.
Martin Hanak
That did not work either, but I have managed to get the traceback logs which are generated when I try and launch the application.
Following is the content I found in the file.
-------------------------------------------------
The trace creation timestamp is: Thu Jul 30 13:28:10 15
The executable build timestamp is: Tue Oct 14 20:37:29 14
The datecode is: 2014350
The pro machine type is: x86e_win64
The process ID is: 388
The traceback type is : CRASH
-------------------------------------------------
Exception EXCEPTION_ACCESS_VIOLATION has occurred in the thread 3292.
Main Thread 3292
=====================
0x000000013FBBE1CC NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x2075898, 0x29f380, 0x29f440, 0x0 )
0x000000013FBBE3BF NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x29f440, 0x1, 0x1, 0x0 )
0x000000013FBB78D0 NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x2, 0x0, 0x4dc301, 0x0 )
0x000000013FBB670E NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x4c7d51, 0x29f7b0, 0x0, 0x0 )
0x000000013FBBCF6D NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x2, 0x4c7c48, 0x0, 0x0 )
0x000000013FBA115C NULL (NULL:0) (qualityagent:0x000000013FBA0000) ( 0x0, 0x0, 0x0, 0x0 )
0x000000007756F56D NULL (NULL:0) (kernel32:0x0000000077550000) ( 0x0, 0x0, 0x0, 0x0 )
Thread 4008
=====================
0x00000000777BFC6A NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x0, 0x101, 0x0, 0x77875470 )
0x0000000077789A07 NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x0, 0x0, 0x0, 0x598eceb9 )
0x000000007756F56D NULL (NULL:0) (kernel32:0x0000000077550000) ( 0x0, 0x0, 0x0, 0x0 )
Thread 2184
=====================
0x00000000777C0FBA NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x1, 0x0, 0x77875298, 0x0 )
0x0000000077788F7B NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x0, 0x0, 0x0, 0x0 )
0x000000007756F56D NULL (NULL:0) (kernel32:0x0000000077550000) ( 0x0, 0x0, 0x0, 0x0 )
Thread 1556
=====================
0x00000000777C0FBA NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x1, 0x0, 0x77875298, 0x0 )
0x0000000077788F7B NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x0, 0x0, 0x0, 0x0 )
0x000000007756F56D NULL (NULL:0) (kernel32:0x0000000077550000) ( 0x0, 0x0, 0x0, 0x0 )
Thread 3896
=====================
0x00000000777BF9FA NULL (NULL:0) (ntdll:0x0000000077770000) ( 0x2aefcd8, 0x0, 0x0, 0xffffff )
0x000007FEFD7C1203 NULL (NULL:0) (KERNELBASE:0x000007FEFD7C0000) ( 0x2035570, 0x0, 0x0, 0x0 )
0x000007FEFDB8EA10 NULL (NULL:0) (ole32:0x000007FEFDB70000) ( 0x2035570, 0xfdb97c5a, 0x0, 0x0 )
0x000007FEFDB9203E NULL (NULL:0) (ole32:0x000007FEFDB70000) ( 0x0, 0x0, 0x0, 0x0 )
0x000007FEFDB9358A NULL (NULL:0) (ole32:0x000007FEFDB70000) ( 0x0, 0x0, 0x0, 0x0 )
0x000000007756F56D NULL (NULL:0) (kernel32:0x0000000077550000) ( 0x0, 0x0, 0x0, 0x0 )
Seems some component of Creo Parametric is crashing when I launch the application because of an access violation,
But I can't seem to figure out what is causing the problem, the invoking of java that has come pre installed with Creo,
or may be the application jar file, but I have made sure that the application jar is placed in an executable location.
(FYI We are using Windows)
Hi,
if you have active Global Support service at PTC then you can ask PTC Support. I do not use PTC Creo Object TOOLKIT java therefore I cannot test your application.
Martin Hanak