プログラムで起動できる Eclipse 起動構成を作成しようとしています。必要に応じて、カスタム デバッガーを構築するようなものです。
、および拡張機能org.eclipse.debug.core.launchConfigurationTypes
だけでなく、拡張機能も既に取得しています。.core.launchDelegates
.ui.launchConfigurationTabGroups
.core.sourcePathComputers
次のコードを実行するボタンがあります。
ILaunchManager mgr = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType lct = mgr.getLaunchConfigurationType(IOpcodeConstants.LAUNCH_CFG_TYPE);
ILaunchConfiguration[] lcs = mgr.getLaunchConfigurations(lct);
for (int i = 0; i < lcs.length; ++i) {
if (lcs[i].getName().equals("Opcode")) {
lcs[i].delete();
break;
}
}
ILaunchConfigurationWorkingCopy wc = lct.newInstance(null, "Opcode");
Set<String> modes = new HashSet<String>();
modes.add(ILaunchManager.DEBUG_MODE);
wc.setModes(modes);
wc.setPreferredLaunchDelegate(modes, "nz.net.fantail.studio.OpcodeLaunchDelegate");
ILaunchConfiguration lc = wc.doSave();
lc.launch(ILaunchManager.DEBUG_MODE, null);
私の起動デリゲートには次のコードがあります。
@Override
public void launch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
ManagementClient client = new ManagementClient("localhost", 6961);
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
IDebugTarget target = new OpcodeDebugTarget(launch, client);
launch.addDebugTarget(target);
}
}
get が ManagementClient クラスのロードを試みて NoSuchClassDefException をスローするまで、すべてが正常に機能します。これは、実際のアプリケーションとは別の環境で起動し、クラスパスにクラスを含む .jar がないためだと思われます。
この問題を回避する方法を知っている人はいますか? 乾杯!