本文整理汇总了Java中org.eclipse.jdt.launching.IVMInstall2.getJavaVersion方法的典型用法代码示例。如果您正苦于以下问题:Java IVMInstall2.getJavaVersion方法的具体用法?Java IVMInstall2.getJavaVersion怎么用?Java IVMInstall2.getJavaVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.launching.IVMInstall2
的用法示例。
在下文中一共展示了IVMInstall2.getJavaVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCompilerCompliance
import org.eclipse.jdt.launching.IVMInstall2; //导入方法依赖的package包/类
public static String getCompilerCompliance(IVMInstall2 vMInstall, String defaultCompliance) {
String version= vMInstall.getJavaVersion();
if (version == null) {
return defaultCompliance;
} else if (version.startsWith(JavaCore.VERSION_1_8)) {
return JavaCore.VERSION_1_8;
} else if (version.startsWith(JavaCore.VERSION_1_7)) {
return JavaCore.VERSION_1_7;
} else if (version.startsWith(JavaCore.VERSION_1_6)) {
return JavaCore.VERSION_1_6;
} else if (version.startsWith(JavaCore.VERSION_1_5)) {
return JavaCore.VERSION_1_5;
} else if (version.startsWith(JavaCore.VERSION_1_4)) {
return JavaCore.VERSION_1_4;
} else if (version.startsWith(JavaCore.VERSION_1_3)) {
return JavaCore.VERSION_1_3;
} else if (version.startsWith(JavaCore.VERSION_1_2)) {
return JavaCore.VERSION_1_3;
} else if (version.startsWith(JavaCore.VERSION_1_1)) {
return JavaCore.VERSION_1_3;
}
return defaultCompliance;
}
示例2: getCompilerCompliance
import org.eclipse.jdt.launching.IVMInstall2; //导入方法依赖的package包/类
public static String getCompilerCompliance(IVMInstall2 vMInstall, String defaultCompliance) {
String version= vMInstall.getJavaVersion();
if (version == null) {
return defaultCompliance;
} else if (version.startsWith(JavaCore.VERSION_1_7)) {
return JavaCore.VERSION_1_7;
} else if (version.startsWith(JavaCore.VERSION_1_6)) {
return JavaCore.VERSION_1_6;
} else if (version.startsWith(JavaCore.VERSION_1_5)) {
return JavaCore.VERSION_1_5;
} else if (version.startsWith(JavaCore.VERSION_1_4)) {
return JavaCore.VERSION_1_4;
} else if (version.startsWith(JavaCore.VERSION_1_3)) {
return JavaCore.VERSION_1_3;
} else if (version.startsWith(JavaCore.VERSION_1_2)) {
return JavaCore.VERSION_1_3;
} else if (version.startsWith(JavaCore.VERSION_1_1)) {
return JavaCore.VERSION_1_3;
}
return defaultCompliance;
}
示例3: prependJREPath
import org.eclipse.jdt.launching.IVMInstall2; //导入方法依赖的package包/类
/**
* Prepends the correct java version variable state to the environment path for Mac VMs
*
* @param env the current array of environment variables to run with
* @param jdkpath the path of the current jdk
* @since 3.3
*/
protected String[] prependJREPath(String[] env) {
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
if (fVMInstance instanceof IVMInstall2) {
IVMInstall2 vm = (IVMInstall2) fVMInstance;
String javaVersion = vm.getJavaVersion();
if (javaVersion != null) {
if (env == null) {
Map map = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved();
if (map.containsKey(JAVA_JVM_VERSION)) {
String[] env2 = new String[map.size()];
Iterator iterator = map.entrySet().iterator();
int i = 0;
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
String key = (String) entry.getKey();
if (JAVA_JVM_VERSION.equals(key)) {
env2[i] = key + "=" + javaVersion; //$NON-NLS-1$
} else {
env2[i] = key + "=" + (String)entry.getValue(); //$NON-NLS-1$
}
i++;
}
env = env2;
}
} else {
for (int i = 0; i < env.length; i++) {
String string = env[i];
if (string.startsWith(JAVA_JVM_VERSION)) {
env[i]=JAVA_JVM_VERSION+"="+javaVersion; //$NON-NLS-1$
break;
}
}
}
}
}
}
return env;
}
示例4: analyze
import org.eclipse.jdt.launching.IVMInstall2; //导入方法依赖的package包/类
/**
* Analyzes the given vm install and returns a collection of compatible
* Select execution environments, possibly empty.
*
* For Select we may match on a subset of SE installs.
*/
public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
throws CoreException {
// Get the Java version string from the VM
if (!(vm instanceof IVMInstall2)) {
Activator.getDefault().log("VM is not a v2 installation : " + vm.getName());
return new CompatibleEnvironment[0];
}
IVMInstall2 vm2 = (IVMInstall2) vm;
String javaVersion = vm2.getJavaVersion();
if (javaVersion == null) {
Activator.getDefault().log(
"VM does not report version string : " + vm.getName());
return new CompatibleEnvironment[0];
}
// Select is a subset of SE runtimes that are 1.5 or above
boolean perfectMatch = javaVersion.startsWith("Harmony-Select-6.0");
if (perfectMatch || javaVersion.startsWith("1.7") || javaVersion.startsWith("1.6")) {
IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
IExecutionEnvironment env = manager.getEnvironment("Harmony-Select-6.0");
if (env != null) {
CompatibleEnvironment[] result = new CompatibleEnvironment[1];
// SE is not a perfect match
result[0] = new CompatibleEnvironment(env, perfectMatch);
return result;
}
}
// We didn't match as a subset
return new CompatibleEnvironment[0];
}