First of all I am working on linux :) I am trying to launch a VM using JDI. I need to change the arguments in a connector. The connector is a LaunchingConnector connector from Bootstrap.virtualMachineManager(). the code is something like this:
for (LaunchingConnector connector : Bootstrap.virtualMachineManager().
launchingConnectors()) {
if (connector.name().equals("com.sun.jdi.CommandLineLaunch")) {
Map<String, Connector.Argument> map = connector.defaultArguments();
StringArgument arg = (StringArgument) map.get("main");
arg.setValue(mainClass); //junit core
arg = (StringArgument) map.get("options");
arg.setValue(classpath);
I am trying to change the classpath so that it looks for the JUnit core I tell it so the new class path is "../../lib/junit-4.6.jar" and the class is "org.junit.runner.JUnitCore"
When I try and run
VirtualMachine vm = connector.launch(map);
it throws a VMStartException because it tries to run a command like this:
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java ../../lib/junit-4.6.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=CIS-Visitor:57881,suspend=y org.junit.runner.JUnitCore
it is not changing the classpath and in the end it does not return a vm. Can anyone tell me a way to change this? I would also like to take out the -Xdebug from the command and change the port number.
Thanks