Skip to main content
4-Participant
August 24, 2022
Solved

.jar needs to be extracted for starting application

  • August 24, 2022
  • 1 reply
  • 2244 views

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

Best answer by sjuraj

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

1 reply

sjuraj15-MoonstoneAnswer
15-Moonstone
August 25, 2022

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

4-Participant
August 26, 2022

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.