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 PTC Community Badges. Engage with PTC and see how many you can earn! X

.jar needs to be extracted for starting application

AS_10362470
4-Participant

.jar needs to be extracted for starting application

Hello,

 

I have created a very simple application using free java API. I am compiling .java to .class and then creating .jar archive. There is protk.dat that goes with it. What I noticed is Creo needs .class files as well along with .jar to start the application. Otherwise application start fails. So if I need to deploy this app I need to extract .class from .jar at same location. Is this expected? or Am I missing any configuration? 

 

Thank you for your help

1 ACCEPTED SOLUTION

Accepted Solutions
sjuraj
13-Aquamarine
(To:AS_10362470)

What creo version do you use ?

If you use Creo 4 or above your app should be packed in jar file. If you have problems loading app make sure jar file ane parent dir of this jar file are in the classpath (e.g. in protk.dat)

If you use Creo 3 or below you can make 1 class file and link you jar file to it as dependency (also make sure this jar file with parent dir are in the classpath)

This loading file is simple

 

package com.domain.appstarter;

public class Starter {

    public static void start() {
        com.domain.app.Main.start()
    }

    public static void stop() {
        com.domain.app.Main.stop()
    }

Make sure your Starter follow package file system hierarchy - as package above it shoul be located in classpath dir as %classpath%\com\domain\appstarter\Starter.class

do not forget specify full path to your Main class 

If your Main class is in the package com.domain.app then in protk.dat file you should have Main java_app_class as com.domain,app.Main not only Main

View solution in original post

2 REPLIES 2
sjuraj
13-Aquamarine
(To:AS_10362470)

What creo version do you use ?

If you use Creo 4 or above your app should be packed in jar file. If you have problems loading app make sure jar file ane parent dir of this jar file are in the classpath (e.g. in protk.dat)

If you use Creo 3 or below you can make 1 class file and link you jar file to it as dependency (also make sure this jar file with parent dir are in the classpath)

This loading file is simple

 

package com.domain.appstarter;

public class Starter {

    public static void start() {
        com.domain.app.Main.start()
    }

    public static void stop() {
        com.domain.app.Main.stop()
    }

Make sure your Starter follow package file system hierarchy - as package above it shoul be located in classpath dir as %classpath%\com\domain\appstarter\Starter.class

do not forget specify full path to your Main class 

If your Main class is in the package com.domain.app then in protk.dat file you should have Main java_app_class as com.domain,app.Main not only Main

AS_10362470
4-Participant
(To:sjuraj)

Thank you for your reply. I made sure I specified full path to my main class. I tried providing path to jar in protk.dat like below -

 

java_app_classpath ./creo_automation.jar

 

This helped! Now I don't need to .class files while running app. Thank you again for your help.

Top Tags