本文整理汇总了Java中org.eclipse.jdt.launching.JavaRuntime.newArchiveRuntimeClasspathEntry方法的典型用法代码示例。如果您正苦于以下问题:Java JavaRuntime.newArchiveRuntimeClasspathEntry方法的具体用法?Java JavaRuntime.newArchiveRuntimeClasspathEntry怎么用?Java JavaRuntime.newArchiveRuntimeClasspathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.JavaRuntime
的用法示例。
在下文中一共展示了JavaRuntime.newArchiveRuntimeClasspathEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prependClasspath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
@Override
public LaunchConfiguration prependClasspath(final String classPathEntry) {
final IRuntimeClasspathEntry newEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(classPathEntry));
try {
this.workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
final List<String> entries =
this.workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<>());
if (entries.isEmpty()) {
entries.add(JavaRuntime.newDefaultProjectClasspathEntry(this.launchedProject).getMemento());
}
entries.add(0, newEntry.getMemento());
this.workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, entries);
} catch (final CoreException coreException) {
final FailureReport<LaunchConfiguration> failure =
new FailureReport<LaunchConfiguration>().cause(coreException);
return FAILURE_HANDLER.handle(failure);
}
return this;
}
示例2: addGwtDevjarIfPossible
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private static void addGwtDevjarIfPossible(IJavaProject proj,
Set<IRuntimeClasspathEntry> classpath) throws CoreException {
GwtSdk runtime = GwtSdk.findSdkFor(proj);
if (runtime == null) {
Activator
.getDefault()
.getLog()
.log(
new Status(IStatus.WARNING, Activator.PLUGIN_ID,
"Unable to find a GWT Runtime for project " + proj.getElementName()
+ ". Cannot add gwt-dev to the runtime classpath."));
return;
}
IStatus validationStatus = runtime.validate();
if (!validationStatus.isOK()) {
throw new CoreException(validationStatus);
}
try {
IPath devJarPath = Path.fromOSString(runtime.getDevJar().getAbsolutePath());
IRuntimeClasspathEntry devJarCpEntry =
JavaRuntime.newArchiveRuntimeClasspathEntry(devJarPath);
classpath.add(devJarCpEntry);
} catch (SdkException sdke) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"Unable to add gwt-dev.jar to the runtime classpath.", sdke));
}
}
示例3: dependenciesForProject
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
/**
* Expand out the list of dependencies for a given IJavaProject.
*/
private List<IRuntimeClasspathEntry> dependenciesForProject(IJavaProject project)
throws CoreException {
ArrayList<IRuntimeClasspathEntry> out = new ArrayList<IRuntimeClasspathEntry>();
String[] deps = JavaRuntime.computeDefaultRuntimeClassPath(project);
for (String dep : deps) {
IRuntimeClasspathEntry cpEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(dep));
out.add(cpEntry);
}
return out;
}
示例4: addEngineLibHomeClassPath
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
private void addEngineLibHomeClassPath( String fileDirectory, List list )
{
File file = new File( fileDirectory );
if ( !file.exists( ) || !file.isDirectory( ) )
{
return;
}
IPath path = new Path( fileDirectory );
String[] files = file.list( );
if ( files == null )
{
return;
}
int len = files.length;
for ( int i = 0; i < len; i++ )
{
IPath temp = path.append( files[i] ).makeAbsolute( );
if ( temp.toFile( ).exists( ) && isJarFile( temp ) )
{
try
{
IRuntimeClasspathEntry entry = JavaRuntime.newArchiveRuntimeClasspathEntry( temp );
String mometo = entry.getMemento( );
if ( !list.contains( mometo ) )
{
list.add( mometo );
}
}
catch ( CoreException e )
{
}
}
}
}
示例5: launch
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
public void launch() throws CoreException{
DerbyPlugin plugin = DerbyPlugin.getDefault();
// constructs a classpath from the default JRE...
IPath systemLibs = new Path(JavaRuntime.JRE_CONTAINER);
IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
systemLibs, IRuntimeClasspathEntry.STANDARD_CLASSES);
systemLibsEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
//include com.pivotal.gemfirexd.internal.core plugin
IRuntimeClasspathEntry derbyCPEntry = null;
List classpath = new ArrayList();
classpath.add(systemLibsEntry.getMemento());
try {
ManifestElement[] elements_core, elements_ui;
elements_core = getElements(CommonNames.CORE_PATH);
elements_ui=getElements(CommonNames.UI_PATH);
Bundle bundle;
URL pluginURL,jarURL,localURL;
bundle=Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for(int i=0;i<elements_core.length;i++){
if(!elements_core[i].getValue().toLowerCase().endsWith("derbynet.jar")){
jarURL= new URL(pluginURL,elements_core[i].getValue());
localURL=Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
bundle=Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for(int i=0;i<elements_ui.length;i++){
if(!elements_ui[i].getValue().toLowerCase().equals("ui.jar")){
jarURL= new URL(pluginURL,elements_ui[i].getValue());
localURL=Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
}
catch(Exception e) {
e.printStackTrace();
Logger.log("Error in launch() "+e,IStatus.ERROR);
}
}
示例6: addProjectEntries
import org.eclipse.jdt.launching.JavaRuntime; //导入方法依赖的package包/类
protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier,
ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) throws CoreException {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(path.segment(0));
IMavenProjectFacade projectFacade = projectManager.create(project, monitor);
if(projectFacade == null) {
return;
}
ResolverConfiguration configuration = projectFacade.getResolverConfiguration();
if(configuration == null) {
return;
}
IJavaProject javaProject = JavaCore.create(project);
boolean projectResolved = false;
for(IClasspathEntry entry : javaProject.getRawClasspath()) {
IRuntimeClasspathEntry rce = null;
switch(entry.getEntryKind()) {
case IClasspathEntry.CPE_SOURCE:
if(!projectResolved) {
IMavenClassifierManager mavenClassifierManager = MavenJdtPlugin.getDefault().getMavenClassifierManager();
IClassifierClasspathProvider classifierClasspathProvider = mavenClassifierManager
.getClassifierClasspathProvider(projectFacade, classifier);
if(IClasspathManager.CLASSPATH_TEST == scope) {
classifierClasspathProvider.setTestClasspath(resolved, projectFacade, monitor);
} else {
classifierClasspathProvider.setRuntimeClasspath(resolved, projectFacade, monitor);
}
projectResolved = true;
}
break;
case IClasspathEntry.CPE_CONTAINER:
IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject);
if(container != null && !MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) {
switch(container.getKind()) {
case IClasspathContainer.K_APPLICATION:
rce = JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(),
IRuntimeClasspathEntry.USER_CLASSES, javaProject);
break;
// case IClasspathContainer.K_DEFAULT_SYSTEM:
// unresolved.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.STANDARD_CLASSES, javaProject));
// break;
// case IClasspathContainer.K_SYSTEM:
// unresolved.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, javaProject));
// break;
}
}
break;
case IClasspathEntry.CPE_LIBRARY:
rce = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath());
break;
case IClasspathEntry.CPE_VARIABLE:
if(!JavaRuntime.JRELIB_VARIABLE.equals(entry.getPath().segment(0))) {
rce = JavaRuntime.newVariableRuntimeClasspathEntry(entry.getPath());
}
break;
case IClasspathEntry.CPE_PROJECT:
IProject res = root.getProject(entry.getPath().segment(0));
if(res != null) {
IJavaProject otherProject = JavaCore.create(res);
if(otherProject != null) {
rce = JavaRuntime.newDefaultProjectClasspathEntry(otherProject);
}
}
break;
default:
break;
}
if(rce != null) {
addStandardClasspathEntries(resolved, rce, launchConfiguration);
}
}
}