Hello everyone!
Please tell me how to add dependencies (other jar files) to the project jar file.
For example, I want to use logging during development, but I can not start the application, since Creo throws an error that the class will not find.
I used the gradle build tool.
I pointed out the classpath in MANIFEST, added jar files inside my jar, but it still doesn't work.
My gradle code:
jar {
//from {
// configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
//}
manifest {
attributes(
"Implementation-Title": "Jar Making Example",
'Implementation-Version': "1.0",
"Main-Class": "ru.Test",
"Class-Path": configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
destinationDirectory = file("build\\tmp\\jar")
archivesBaseName = 'app'
//C:\Program Files\PTC\Creo 5.0.2.0\Common Files\text\java\otk.jar
}
My jar:
My MANIFEST:
My code:
public class Test {
private static final Logger log = LogManager.getLogger(Test.class);
public static void start() throws jxthrowable {
Session session = pfcSession.GetCurrentSessionWithCompatibility(CreoCompatibility.C4Compatible);
session.UIShowMessageDialog("Hello", null);
log.error("Hello!");
}
public static void stop() throws jxthrowable {
}
}
This code works without the log4j2 classes in Creo.
Logging also works in the IDE if the start () method is started from the main () method.
Thanks in advance!
Best Regards!
Solved! Go to Solution.
Hi,
you can add information about dependencies in the registry file called creotk.dat or protk.dat to field java_app_classpath.
For more info search CLASSPATH Variables and Registry File in documentation.
Hi,
you can add information about dependencies in the registry file called creotk.dat or protk.dat to field java_app_classpath.
For more info search CLASSPATH Variables and Registry File in documentation.
Thanks for the answer!