Just add a java step in the activity. You would have to include all the dependent jars in the pega classpath (either importing to db or include them in the app server claspath). Suggest you can your program from the command line first outside eclipse to make sure you know exactly what jars are needed for your program.
You can import java jar files and build necessary library and function which can call your java methods/utilities.So while shipping you can also include jar in the Rule-Admin-Product. So it depends on what kind of functionlatity you have in the java code, you can take on whether to bring it to pega application or maintaining it seperatly and always import as java jars.