Your concern is definitely warranted. What application server are you running? There maybe ways you can run your java outside Pega classloader (which is custom based out of pega database). Also elaborate what your program does, does it use Pega engine features or is it completely independent?
We are currently running on Websphere, near soon we move to Tomcat. So we need solution in both the scenarios.
My program is for sending message to an kafka topic. which internally use Avro for message formats. we have set of java methods defined in internal sdk which we are going to invoke from Pega utility function. for which we are trying to deploy JARs.
Write a utility function with message as input parameter
Get Topic details like topic name, scheme URL, keystore location,encrytption mechanism, retry count etc--> These details will be pulled from a data type using a data page.
put all the above details to properties object(java.util.Properties)
invoke sending Axon message methods
Log this for debugging and exception handling purpose
set the status back as return value.
So we may write java using Pega PublicAPI to get data page, setting Properties object(java.util.Properties) and log messages, getting/ parameters, clipboard values.
You can try to use shared lib approach in WebSphere to reference your own jars. If that does not work or you need specific help step by step, create a SR with Pega GCS so that our engineer can work with you closely.