diff --git a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/TracerLaunchConfigurationDelegate.java b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/TracerLaunchConfigurationDelegate.java index caa64f9..b25418c 100644 --- a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/TracerLaunchConfigurationDelegate.java +++ b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/TracerLaunchConfigurationDelegate.java @@ -1,9 +1,11 @@ package org.ntlab.traceCollector; import java.io.File; +import java.io.IOException; import java.util.Map; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.debug.core.ILaunch; @@ -62,13 +64,14 @@ // Classpath String[] configClasspath = getClasspath(configuration); String[] classpath; - String bundlePath = Activator.getDefault().getBundle().getLocation(); - if (bundlePath.startsWith("reference:file:/")) { +// String bundlePath = Activator.getDefault().getBundle().getLocation(); + try { + String bundlePath = FileLocator.resolve(Activator.getDefault().getBundle().getEntry("/")).getPath(); classpath = new String[configClasspath.length + 2]; System.arraycopy(configClasspath, 0, classpath, 0, configClasspath.length); - classpath[configClasspath.length] = bundlePath.substring(16) + "bin/"; - classpath[configClasspath.length + 1] = bundlePath.substring(16) + Tracer.JAVASSIST_LIBRARY; - } else { + classpath[configClasspath.length] = bundlePath.substring(1) + "bin/"; + classpath[configClasspath.length + 1] = bundlePath.substring(1) + Tracer.JAVASSIST_LIBRARY; + } catch (IOException e) { classpath = configClasspath; } diff --git a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/handlers/InstrumentationHandler.java b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/handlers/InstrumentationHandler.java index b4ae0db..b7c1cc3 100644 --- a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/handlers/InstrumentationHandler.java +++ b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/handlers/InstrumentationHandler.java @@ -1,5 +1,8 @@ package org.ntlab.traceCollector.handlers; +import java.io.File; +import java.io.IOException; + import javassist.ClassPool; import javassist.CodeConverter; import javassist.NotFoundException; @@ -7,6 +10,7 @@ import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.viewers.ISelection; @@ -35,10 +39,13 @@ try { // Javassist �� ClassPool �� Javassist ���C�u�������A����т��̃v���O�C�����̃N���X�����‚�����悤�ɂ��� ClassPool cp = ClassPool.getDefault(); - String bundlePath = Activator.getDefault().getBundle().getLocation(); - if (bundlePath.startsWith("reference:file:/")) { - cp.appendClassPath(bundlePath.substring(16) + "bin/"); - cp.appendClassPath(bundlePath.substring(16) + Tracer.JAVASSIST_LIBRARY); +// String bundlePath = Activator.getDefault().getBundle().getLocation(); + try { + String bundlePath = FileLocator.resolve(Activator.getDefault().getBundle().getEntry("/")).getPath(); + cp.appendClassPath(bundlePath.substring(1) + "bin/"); + cp.appendClassPath(bundlePath.substring(1) + Tracer.JAVASSIST_LIBRARY); + } catch (IOException e) { + e.printStackTrace(); } // Javassist �� ClassPool �� �Ώۃv���O�������̃N���X�����‚�����悤�ɂ��� String projectLocation = javaProject.getProject().getLocation().toString();