VirtualMachineManager

Java Code Examples for com.sun.jdi.VirtualMachineManager

https://www.programcreek.com/java-api-examples/index.php?api=com.sun.jdi.VirtualMachineManager

The following are top voted examples for showing how to use com.sun.jdi.VirtualMachineManager. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to product more good examples. 

+  Save this class to your library
 
Example 1
Project: fiji   File: StartDebugging.java View source code6 votesvote downvote up
private  VirtualMachine launchVirtualMachine() { VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); LaunchingConnector defConnector = vmm.defaultConnector(); Transport transport = defConnector.transport(); List<LaunchingConnector> list = vmm.launchingConnectors(); for (LaunchingConnector conn: list) System.out.println(conn.name()); Map<String, Connector.Argument> arguments = defConnector.defaultArguments(); Set<String> s = arguments.keySet(); for (String string: s) System.out.println(string); Connector.Argument mainarg = arguments.get("main"); String s1 = System.getProperty("java.class.path"); mainarg.setValue("-classpath \"" + s1 + "\" fiji.MainClassForDebugging " + plugInName); try { return defConnector.launch(arguments); } catch (IOException exc) { throw new Error("Unable to launch target VM: " + exc); } catch (IllegalConnectorArgumentsException exc) { IJ.handleException(exc); } catch (VMStartException exc) { throw new Error("Target VM failed to initialize: " + exc.getMessage()); } return null; }

Example 2
Project: proxyhotswap   File: JDIRedefiner.java View source code6 votesvote downvote up
private VirtualMachine connect(int port) throws IOException { VirtualMachineManager manager = Bootstrap.virtualMachineManager(); // Find appropiate connector List<AttachingConnector> connectors = manager.attachingConnectors(); AttachingConnector chosenConnector = null; for (AttachingConnector c : connectors) { if (c.transport().name().equals(TRANSPORT_NAME)) { chosenConnector = c; break; } } if (chosenConnector == null) { throw new IllegalStateException("Could not find socket connector"); } // Set port argument AttachingConnector connector = chosenConnector; Map<String, Argument> defaults = connector.defaultArguments(); Argument arg = defaults.get(PORT_ARGUMENT_NAME); if (arg == null) { throw new IllegalStateException("Could not find port argument"); } arg.setValue(Integer.toString(port)); // Attach try { System.out.println("Connector arguments: " + defaults); return connector.attach(defaults); } catch (IllegalConnectorArgumentsException e) { throw new IllegalArgumentException("Illegal connector arguments", e); } }
Example 3
Project: robovm-eclipse   File: AbstractLaunchConfigurationDelegate.java View source code6 votesvote downvote up
private VirtualMachine attachToVm(IProgressMonitor monitor, int port) throws CoreException { VirtualMachineManager manager = Bootstrap.virtualMachineManager(); AttachingConnector connector = null; for (Iterator<?> it = manager.attachingConnectors().iterator(); it.hasNext();) { AttachingConnector con = (AttachingConnector) it.next(); if ("dt_socket".equalsIgnoreCase(con.transport().name())) { connector = con; break; } } if (connector == null) { throw new CoreException(new Status(IStatus.ERROR, RoboVMPlugin.PLUGIN_ID, "Couldn't find socket transport")); } Map<String, Argument> defaultArguments = connector.defaultArguments(); defaultArguments.get("hostname").setValue("localhost"); defaultArguments.get("port").setValue("" + port); int retries = 60; CoreException exception = null; while (retries > 0) { try { return connector.attach(defaultArguments); } catch (Exception e) { exception = new CoreException(new Status(IStatus.ERROR, RoboVMPlugin.PLUGIN_ID, "Couldn't connect to JDWP server at localhost:" + port, e));

转载于:https://www.cnblogs.com/developer-ios/p/7506145.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值