Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Startup of Application failed while using

shri136

New member
Hello,


I am trying to customize Pro-E using J-link.


But while running the J-link Program, I am getting error as "Startup of Application failed"
smiley5.gif
.


The Protk.dat file was placed at "<Pro-E install directory>/text" path.


Protk.dat file is as below:


================================================
name JLinkHelloWorld-App
startup java
java_app_class JLinkHelloWorld
java_app_start start
java_app_stop stop
allow_stop true
delay_start false
text_dir C:\JLinkHelloWorld\text
java_app_classpath C:\JLinkHelloWorld\JLinkHelloWorld;C:/Users/228361/Desktop/D imension_Numbering/pfc.jar
end
====================================================


and java program is:


package com.cognizant.jlinkDemo;

import java.io.FileWriter;

import com.ptc.cipjava.jxthrowable;
import com.ptc.cipjava.stringseq;
//import com.ptc.pfc.Implementation.Starter;
import com.ptc.pfc.pfcGlobal.pfcGlobal;
import com.ptc.pfc.pfcSession.Session;

public class JLinkHelloWorld {

static JLinkHelloWorld App = null;
String programName = null;
String directoryName = null;
Session session = null;
FileWriter log = null;
String msgFile = "msg_jlinkhelloworld.txt";
String newline = null;

//Constructor of Class file

public JLinkHelloWorld(){

programName = this.getClass().getName();

try{
log = new FileWriter(programName + ".log");
newline = System.getProperty("line.separator");
directoryName = session.GetCurrentDirectory();
}
catch(Exception e){

}

}

//Displaying message in Pro-Engineer

public void displayMessage(String msg) throws Exception{

stringseq seq = stringseq.create();
seq.set(0, msg);
session.UIDisplayMessage(msgFile, "JLHW %s", seq);
session.UIShowMessageDialog(directoryName, null);
seq.clear();
writeLog(msg);
}

//Write text to log file

public void writeLog(String msg){
try{
if (log == null){
return;
}
log.write(msg+newline);
log.flush();
}
catch (Exception e){

}
}

// tile to close log file

public void closeLog(){
try{
if (log == null){
return;
}
}
catch (Exception e){

}
}



/************************************************
* public static void main(String args[]){
*
*
* System.out.println("this is proE start up");
* JLinkHelloWorld j = new JLinkHelloWorld();
* j.start();
* System.out.println("after the startup");
*
}
**************************************************/

// Called by Pro-E when starting the application

public void start(){
try{
App = new JLinkHelloWorld();
App.startupApplication();
}
catch (Exception e){
App.writeLog("Problem running startupApplication method"+e.toString());
System.out.println("Exception thrown:"+e.getMessage());
return;
}
}

// Called by Pro-E when stopping the application

public static void stop(){
try{
App.stopApplication();
}
catch (Exception e){
App.writeLog("Problem running shutdownApplication method" + e.toString());
return;
}
}

// How startupApplication method will work

public void startupApplication() throws Exception {
try{
writeLog("Application '" + programName + "' started");
session = pfcGlobal.GetProESession();
}
catch (jxthrowable x){
writeLog("Error: Problem while getting session object..");
return;
}
}

//How stopApplication method will work

public void stopApplication()throws Exception{

writeLog("Application '" + programName + "' stopped");
closeLog();
}
}
 
Hi shri136!

I had this same error last week and it took me a while to
solve it.
First, you have to pay attention to environment variable
PRO_JAVA_COMMAND or is equivalent in
config.pro jlink_java_command...
If you're customizing Creo, they must be set to full path
of java.exe. Creo's install don't store a local
version in it's folder by default and it's unable to
detect previously installed java.
I suggest you to take attention to
java_app_classpath in protk.dat.
If you use only .class files, it should be set to
DIRECTORY only.
If you use .jar, it should be set to FULL
PATH
.
The text_dir variable is very tricky too!
J-Link User Guide tells that the value must be
yourprogram/text and the real path must should be
yourprogram/text/usascii/youtextfile.txt.
Anything different from that, may and may not work.
I tried several configurations until find that way...
Sorry bad English...
smiley1.gif
 
Hey Caverna,


Really grateful for your suggestions and time.


I followed your suggestions; but all are useless.


I made folder named JLinkHelloWorld at C: drive. In this folder i have pasted class file, java file, protk.dat file, text folder as per your structure and pfc.jar file.


Hereis myprotk.dat file.


====================


name JLinkHelloWorld-App


startup java


java_app_class JLinkHelloWorld


java_app_start start


java_app_stop stop


allow_stop true


delay_start false


text_dir C:\JLinkHelloWorld\text


java_app_classpath C:\JLinkHelloWorld;C:\Program Files\proeWildfire 4.0\text\java/pfc.jar


end


=============================


Please overview it once and let me know is itcorrect or not.





Thanks,


Shri Master
 
you don't need to copy pfc.jar file
and try to put just yourpatth in
java_app_classpath variable.
try to use delay_start as true and manually
run your app...
I spent a long time trying to run that 'helloworld' and now
it's running flawless...
smiley1.gif
 
Hello Caverna,


Thanks for your suggestions. I tried your suggestions.


But still I am getting the same error.
smiley19.gif



Is it possible for you to share your Helloworld sample program and protk.dat file and whatever steps and settings you are following before going for launching the code.


Hopefully that will help me better. Thanks again for your valueable time and guidance.
smiley1.gif
 
Hi shri136!

Here is a JBuilder project:
<a href="uploads/Caverna/2012-04-
<br / target="_blank">04_084856_JLinkHelloWorld.zip">2012-04-
04_084856_JLinkHelloWorld.zip</a>
There is a compiled version inside.
I think that this is from the same tutorial that you're
using. :)

This is a 4shared link:
http://www.4shared.com/zip/532QdXp9/JLinkHelloWorld.html

It seems that forum uploads aren't functioning well
Edited by: Caverna
 
Hi Caverna,


the path and link you uploaded is not accesible for me right now.


Is it possible for you to share the steps and settings you are performing before starting j-link application. I am starting application from tools --> Auxillary Application.... Am Idoing right?
smiley5.gif



Please share your java file and protk.dat along with steps...
smiley9.gif



Thanks Caverna...
smiley1.gif
 
Hi shri136,

I think that my files are the same of yours...
This is my entire configuration.

Environment variables ------------------

PFCLS_START_DIR=C:\Program Files\PTC\Creo 1.0\Common
Files\M010\x86e_win64\obj
PRO_COMM_MSG_EXE="C:\Program Files\PTC\Creo 1.0\Common
Files\M010\x86e_win64\obj\pro_comm_msg.exe"

Environment variables ------------------


config.pro -----------------------------

jlink_java_command C:\Program
Files\Java\jre7\bin\java.exe
protkdat C:\TEMP\JLinkHelloWorld\protk.dat

config.pro -----------------------------


protk.dat ------------------------------

name
 
Sorry, the forum are posting wrong source code!
email-me to send directly to you.
Caverna<- removed email,
avoiding spam
smiley36.gif

Edited by: Caverna
 
Did you find solution how to make this JLinkHelloWorld
work, I have allways the same error "Startup of Application
failed".
I'am trying to lern this J-link but can't find any useful
information that could show how to solve this problem.
 
Did you see the second message of this topic?
shri136 had an very specif error, but I think you should be
able to fix just using that info...
Let me know if it doesn't work.
 

Sponsor

Articles From 3DCAD World

Back
Top