The Install class used by script bminstall.sh to install the Bteman agent into a running program is built to be driven from a command line. It only provides a public main routine and this calls System.exit when things go wrong. It should also provide an API which can be called to install the agent and which will generate sensible errors if the install fails. The API should be
install(String pid, boolean addToBoot, String host, int port, String[] properties)
throws IllegalArgumentException, FileNotFoundException,
IOException, AttachNotSupportedException,
AgentLoadException, AgentInitializationException
pid will normally be the process id of the JVM. However, it can also be the ame of the java app as displayed by the jps command or the tail of the program name. For example, JBoss will be reported as org.jboss.Main so pid can be supplied using this name or using jboss.Main or Main. Of course thelast of these might be ambiguous if e.g. there is another JVM running com.Intellij.Main. In such cases you get whatever JVM is found first.
The various possible errors occur for the obvious reasons. AgentInitializationException probably indicates that the agent is already loaded in the target JVM.