当前位置: 首页>>代码示例>>Java>>正文


Java Main.getLibrariesFiles方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.batch.Main.getLibrariesFiles方法的典型用法代码示例。如果您正苦于以下问题:Java Main.getLibrariesFiles方法的具体用法?Java Main.getLibrariesFiles怎么用?Java Main.getLibrariesFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.compiler.batch.Main的用法示例。


在下文中一共展示了Main.getLibrariesFiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultBootclasspath

import org.eclipse.jdt.internal.compiler.batch.Main; //导入方法依赖的package包/类
Iterable<? extends File> getDefaultBootclasspath() {
	ArrayList<File> files = new ArrayList<File>();
	String javaversion = System.getProperty("java.version");//$NON-NLS-1$
	if(javaversion.length() > 3)
		javaversion = javaversion.substring(0, 3);
	long jdkLevel = CompilerOptions.versionToJdkLevel(javaversion);
	if (jdkLevel < ClassFileConstants.JDK1_6) {
		// wrong jdk - 1.6 or above is required
		return null;
	}

	/*
	 * Handle >= JDK 1.6
	 */
	String javaHome = System.getProperty("java.home"); //$NON-NLS-1$
	File javaHomeFile = null;
	if (javaHome != null) {
		javaHomeFile = new File(javaHome);
		if (!javaHomeFile.exists())
			javaHomeFile = null;
	}

	addFilesFrom(javaHomeFile, "java.endorsed.dirs", "/lib/endorsed", files);//$NON-NLS-1$//$NON-NLS-2$
	if (javaHomeFile != null) {
		File[] directoriesToCheck = null;
		if (System.getProperty("os.name").startsWith("Mac")) {//$NON-NLS-1$//$NON-NLS-2$
			directoriesToCheck = new File[] { new File(javaHomeFile, "../Classes"), //$NON-NLS-1$
			};
		} else {
			directoriesToCheck = new File[] { new File(javaHomeFile, "lib") //$NON-NLS-1$
			};
		}
		File[][] jars = Main.getLibrariesFiles(directoriesToCheck);
		addFiles(jars, files);
	}
	addFilesFrom(javaHomeFile, "java.ext.dirs", "/lib/ext", files);//$NON-NLS-1$//$NON-NLS-2$
	return files;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:EclipseFileManager.java

示例2: getDefaultBootclasspath

import org.eclipse.jdt.internal.compiler.batch.Main; //导入方法依赖的package包/类
Iterable<? extends File> getDefaultBootclasspath() {
	ArrayList<File> files = new ArrayList<File>();
	String javaversion = System.getProperty("java.version");//$NON-NLS-1$
	if (javaversion != null && !javaversion.startsWith("1.6")) { //$NON-NLS-1$	
		// wrong jdk - 1.6 is required
		return null;
	}

	/*
	 * Handle >= JDK 1.6
	 */
	String javaHome = System.getProperty("java.home"); //$NON-NLS-1$
	File javaHomeFile = null;
	if (javaHome != null) {
		javaHomeFile = new File(javaHome);
		if (!javaHomeFile.exists())
			javaHomeFile = null;
	}

	addFilesFrom(javaHomeFile, "java.endorsed.dirs", "/lib/endorsed", files);//$NON-NLS-1$//$NON-NLS-2$
	if (javaHomeFile != null) {
		File[] directoriesToCheck = null;
		if (System.getProperty("os.name").startsWith("Mac")) {//$NON-NLS-1$//$NON-NLS-2$
			directoriesToCheck = new File[] { new File(javaHomeFile, "../Classes"), //$NON-NLS-1$
			};
		} else {
			directoriesToCheck = new File[] { new File(javaHomeFile, "lib") //$NON-NLS-1$
			};
		}
		File[][] jars = Main.getLibrariesFiles(directoriesToCheck);
		addFiles(jars, files);
	}
	addFilesFrom(javaHomeFile, "java.ext.dirs", "/lib/ext", files);//$NON-NLS-1$//$NON-NLS-2$
	return files;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:36,代码来源:EclipseFileManager.java

示例3: collectRunningVMBootclasspath

import org.eclipse.jdt.internal.compiler.batch.Main; //导入方法依赖的package包/类
public static void collectRunningVMBootclasspath(List bootclasspaths) {
	/* no bootclasspath specified
	 * we can try to retrieve the default librairies of the VM used to run
	 * the batch compiler
	 */
	String javaversion = System.getProperty("java.version");//$NON-NLS-1$
	if (javaversion != null && javaversion.equalsIgnoreCase("1.1.8")) { //$NON-NLS-1$
		throw new IllegalStateException();
	}

	/*
	 * Handle >= JDK 1.2.2 settings: retrieve the bootclasspath
	 */
	// check bootclasspath properties for Sun, JRockit and Harmony VMs
	String bootclasspathProperty = System.getProperty("sun.boot.class.path"); //$NON-NLS-1$
	if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
		// IBM J9 VMs
		bootclasspathProperty = System.getProperty("vm.boot.class.path"); //$NON-NLS-1$
		if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
			// Harmony using IBM VME
			bootclasspathProperty = System.getProperty("org.apache.harmony.boot.class.path"); //$NON-NLS-1$
		}
	}
	if ((bootclasspathProperty != null) && (bootclasspathProperty.length() != 0)) {
		StringTokenizer tokenizer = new StringTokenizer(bootclasspathProperty, File.pathSeparator);
		String token;
		while (tokenizer.hasMoreTokens()) {
			token = tokenizer.nextToken();
			FileSystem.Classpath currentClasspath = FileSystem.getClasspath(token, null, null);
			if (currentClasspath != null) {
				bootclasspaths.add(currentClasspath);
			}
		}
	} else {
		// try to get all jars inside the lib folder of the java home
		final File javaHome = getJavaHome();
		if (javaHome != null) {
			File[] directoriesToCheck = null;
			if (System.getProperty("os.name").startsWith("Mac")) {//$NON-NLS-1$//$NON-NLS-2$
				directoriesToCheck = new File[] {
					new File(javaHome, "../Classes"), //$NON-NLS-1$
				};
			} else {
				// fall back to try to retrieve them out of the lib directory
				directoriesToCheck = new File[] {
					new File(javaHome, "lib") //$NON-NLS-1$
				};
			}
			File[][] systemLibrariesJars = Main.getLibrariesFiles(directoriesToCheck);
			if (systemLibrariesJars != null) {
				for (int i = 0, max = systemLibrariesJars.length; i < max; i++) {
					File[] current = systemLibrariesJars[i];
					if (current != null) {
						for (int j = 0, max2 = current.length; j < max2; j++) {
							FileSystem.Classpath classpath =
								FileSystem.getClasspath(current[j].getAbsolutePath(),
									null, false, null, null);
							if (classpath != null) {
								bootclasspaths.add(classpath);
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:68,代码来源:Util.java

示例4: collectRunningVMBootclasspath

import org.eclipse.jdt.internal.compiler.batch.Main; //导入方法依赖的package包/类
public static void collectRunningVMBootclasspath(List bootclasspaths) {
      /* no bootclasspath specified
 * we can try to retrieve the default librairies of the VM used to run
 * the batch compiler
 */
      String javaversion = System.getProperty("java.version");//$NON-NLS-1$
      if (javaversion != null && javaversion.equalsIgnoreCase("1.1.8")) { //$NON-NLS-1$
          throw new IllegalStateException();
      }

/*
 * Handle >= JDK 1.2.2 settings: retrieve the bootclasspath
 */
      // check bootclasspath properties for Sun, JRockit and Harmony VMs
      String bootclasspathProperty = System.getProperty("sun.boot.class.path"); //$NON-NLS-1$
      if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
          // IBM J9 VMs
          bootclasspathProperty = System.getProperty("vm.boot.class.path"); //$NON-NLS-1$
          if ((bootclasspathProperty == null) || (bootclasspathProperty.length() == 0)) {
              // Harmony using IBM VME
              bootclasspathProperty = System.getProperty("org.apache.harmony.boot.class.path"); //$NON-NLS-1$
          }
      }
      if ((bootclasspathProperty != null) && (bootclasspathProperty.length() != 0)) {
          StringTokenizer tokenizer = new StringTokenizer(bootclasspathProperty, File.pathSeparator);
          String token;
          while (tokenizer.hasMoreTokens()) {
              token = tokenizer.nextToken();
              FileSystem.Classpath currentClasspath = FileSystem.getClasspath(token, null, null);
              if (currentClasspath != null) {
                  bootclasspaths.add(currentClasspath);
              }
          }
      } else {
          // try to get all jars inside the lib folder of the java home
          final File javaHome = getJavaHome();
          if (javaHome != null) {
              File[] directoriesToCheck = null;
              if (System.getProperty("os.name").startsWith("Mac")) {//$NON-NLS-1$//$NON-NLS-2$
                  directoriesToCheck = new File[]{
                          new File(javaHome, "../Classes"), //$NON-NLS-1$
                  };
              } else {
                  // fall back to try to retrieve them out of the lib directory
                  directoriesToCheck = new File[]{
                          new File(javaHome, "lib") //$NON-NLS-1$
                  };
              }
              File[][] systemLibrariesJars = Main.getLibrariesFiles(directoriesToCheck);
              if (systemLibrariesJars != null) {
                  for (int i = 0, max = systemLibrariesJars.length; i < max; i++) {
                      File[] current = systemLibrariesJars[i];
                      if (current != null) {
                          for (int j = 0, max2 = current.length; j < max2; j++) {
                              FileSystem.Classpath classpath =
                                      FileSystem.getClasspath(current[j].getAbsolutePath(),
                                              null, false, null, null);
                              if (classpath != null) {
                                  bootclasspaths.add(classpath);
                              }
                          }
                      }
                  }
              }
          }
      }
  }
 
开发者ID:drxaos,项目名称:jvmvm,代码行数:68,代码来源:NameEnv.java


注:本文中的org.eclipse.jdt.internal.compiler.batch.Main.getLibrariesFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。