本文整理汇总了Java中com.intellij.execution.configurations.JavaParameters.getJdk方法的典型用法代码示例。如果您正苦于以下问题:Java JavaParameters.getJdk方法的具体用法?Java JavaParameters.getJdk怎么用?Java JavaParameters.getJdk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.configurations.JavaParameters
的用法示例。
在下文中一共展示了JavaParameters.getJdk方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkTargetJPDAInstalled
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
private static void checkTargetJPDAInstalled(JavaParameters parameters) throws ExecutionException {
final Sdk jdk = parameters.getJdk();
if (jdk == null) {
throw new ExecutionException(DebuggerBundle.message("error.jdk.not.specified"));
}
final JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
String versionString = jdk.getVersionString();
if (version == JavaSdkVersion.JDK_1_0 || version == JavaSdkVersion.JDK_1_1) {
throw new ExecutionException(DebuggerBundle.message("error.unsupported.jdk.version", versionString));
}
if (SystemInfo.isWindows && version == JavaSdkVersion.JDK_1_2) {
final VirtualFile homeDirectory = jdk.getHomeDirectory();
if (homeDirectory == null || !homeDirectory.isValid()) {
throw new ExecutionException(DebuggerBundle.message("error.invalid.jdk.home", versionString));
}
//noinspection HardCodedStringLiteral
File dllFile = new File(
homeDirectory.getPath().replace('/', File.separatorChar) + File.separator + "bin" + File.separator + "jdwp.dll"
);
if (!dllFile.exists()) {
GetJPDADialog dialog = new GetJPDADialog();
dialog.show();
throw new ExecutionException(DebuggerBundle.message("error.debug.libraries.missing"));
}
}
}
示例2: updateJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters params, RunnerSettings runnerSettings) {
if (!isApplicableFor(configuration)) {
return;
}
final JavaCoverageEnabledConfiguration coverageConfig = JavaCoverageEnabledConfiguration.getFrom(configuration);
//noinspection ConstantConditions
coverageConfig.setCurrentCoverageSuite(null);
final CoverageRunner coverageRunner = coverageConfig.getCoverageRunner();
if (runnerSettings instanceof CoverageRunnerData && coverageRunner != null) {
final CoverageDataManager coverageDataManager = CoverageDataManager.getInstance(configuration.getProject());
coverageConfig.setCurrentCoverageSuite(coverageDataManager.addCoverageSuite(coverageConfig));
coverageConfig.appendCoverageArgument(configuration, params);
final Sdk jdk = params.getJdk();
if (jdk != null && JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_7) && coverageRunner instanceof JavaCoverageRunner && !((JavaCoverageRunner)coverageRunner).isJdk7Compatible()) {
Notifications.Bus.notify(new Notification("Coverage", "Coverage instrumentation is not fully compatible with JDK 7",
coverageRunner.getPresentableName() +
" coverage instrumentation can lead to java.lang.VerifyError errors with JDK 7. If so, please try IDEA coverage runner.",
NotificationType.WARNING));
}
}
}
示例3: setToolsJar
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
protected static void setToolsJar(JavaParameters params) {
Sdk jdk = params.getJdk();
if (jdk != null && jdk.getSdkType() instanceof JavaSdkType) {
String toolsPath = ((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk);
if (toolsPath != null) {
params.getVMParametersList().add("-Dtools.jar=" + toolsPath);
}
}
}
示例4: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final String sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
vm.defineProperty("idea.home.path", sandboxHome + File.separator + "test");
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", sandboxHome + File.separator + "plugins");
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例5: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable final Module module, JavaParameters javaParameters) {
if (module != null && PsiUtil.isIdeaProject(module.getProject()) &&
!javaParameters.getVMParametersList().hasParameter(JAVA_SYSTEM_CLASS_LOADER_PROPERTY)) {
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(module.getProject());
final String qualifiedName = UrlClassLoader.class.getName();
final PsiClass urlLoaderClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@Override
public PsiClass compute() {
return psiFacade.findClass(qualifiedName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
}
});
if (urlLoaderClass != null) {
javaParameters.getVMParametersList().add("-D" + JAVA_SYSTEM_CLASS_LOADER_PROPERTY + "=" + UrlClassLoader.class.getName());
}
}
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final File sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
File homeDir = new File(sandboxHome, "test");
FileUtil.createDirectory(homeDir);
vm.defineProperty("idea.home.path", homeDir.getAbsolutePath());
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", new File(sandboxHome, "plugins").getAbsolutePath());
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例6: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
@Override
public void patchJavaParameters(Executor executor, RunProfile configuration, JavaParameters javaParameters) {
if (!executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
return;
}
if (!GroovyDebuggerSettings.getInstance().ENABLE_GROOVY_HOTSWAP) {
return;
}
if (hasSpringLoadedReloader(javaParameters)) {
return;
}
if (!(configuration instanceof RunConfiguration)) {
return;
}
final Project project = ((RunConfiguration)configuration).getProject();
if (project == null) {
return;
}
if (!LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
if (configuration instanceof ModuleBasedConfiguration) {
final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
if (module != null) {
final LanguageLevel level = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
if (level != null && !level.isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
}
}
Sdk jdk = javaParameters.getJdk();
if (jdk != null) {
String vendor = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VENDOR);
if (vendor != null && vendor.contains("IBM")) {
LOG.info("Due to IBM JDK pecularities (IDEA-59070) we don't add groovy agent when running applications under it");
return;
}
}
if (!project.isDefault() && containsGroovyClasses(project)) {
final String agentPath = handleSpacesInPath(getAgentJarPath());
if (agentPath != null) {
javaParameters.getVMParametersList().add("-javaagent:" + agentPath);
}
}
}
示例7: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void patchJavaParameters(Executor executor, RunProfile configuration, JavaParameters javaParameters) {
if (!executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
return;
}
if (!GroovyDebuggerSettings.getInstance().ENABLE_GROOVY_HOTSWAP) {
return;
}
if (hasSpringLoadedReloader(javaParameters)) {
return;
}
if (!(configuration instanceof RunConfiguration)) {
return;
}
final Project project = ((RunConfiguration)configuration).getProject();
if (project == null) {
return;
}
if (!LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
if (configuration instanceof ModuleBasedConfiguration) {
final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
if (module != null) {
final LanguageLevel level = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
if (level != null && !level.isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
}
}
Sdk jdk = javaParameters.getJdk();
if (jdk != null) {
String vendor = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VENDOR);
if (vendor != null && vendor.contains("IBM")) {
LOG.info("Due to IBM JDK pecularities (IDEA-59070) we don't add groovy agent when running applications under it");
return;
}
}
if (!project.isDefault() && containsGroovyClasses(project)) {
final String agentPath = handleSpacesInPath(getAgentJarPath());
if (agentPath != null) {
javaParameters.getVMParametersList().add("-javaagent:" + agentPath);
}
}
}