@Override public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException { final Module module = getModule(); if (module == null) { throw new ExecutionException("Module is not specified"); } if (!isSupport(module)) { throw new ExecutionException(getNoSdkMessage()); } final ModuleRootManager rootManager = ModuleRootManager.getInstance(module); final Sdk sdk = rootManager.getSdk(); if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) { throw CantRunException.noJdkForModule(module); } return createCommandLineState(environment, module); }
@Override public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) { final Collection<? extends Artifact> artifacts = ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance()); if (artifacts.isEmpty()) return; final Sdk[] jdks = BuildProperties.getUsedJdks(project); Sdk javaSdk = null; for (Sdk jdk : jdks) { if (jdk.getSdkType() instanceof JavaSdkType) { javaSdk = jdk; break; } } if (javaSdk != null) { final Tag taskdef = new Tag("taskdef", Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"), Couple.of("uri", "javafx:com.sun.javafx.tools.ant"), Couple.of("classpath", BuildProperties .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) + "/lib/ant-javafx.jar")); generator.add(taskdef); } }
private static String[] createParserSetupCommand(final Sdk jdk) { final VirtualFile homeDirectory = jdk.getHomeDirectory(); if (homeDirectory == null) { throw new IllegalArgumentException(CompilerBundle.jdkHomeNotFoundMessage(jdk)); } final List<String> commandLine = new ArrayList<String>(); commandLine.add(((JavaSdkType)jdk.getSdkType()).getVMExecutablePath(jdk)); CompilerUtil.addLocaleOptions(commandLine, false); //noinspection HardCodedStringLiteral commandLine.add("-classpath"); commandLine.add(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk) + File.pathSeparator + JavaSdkUtil.getIdeaRtJarPath()); commandLine.add(JavacResourcesReader.class.getName()); return ArrayUtil.toStringArray(commandLine); }
private void createStartupCommand(final ModuleChunk chunk, @NonNls final ArrayList<String> commandLine, final String outputPath, final boolean useTempFile) throws IOException { final EclipseCompilerOptions options = EclipseCompilerConfiguration.getOptions(myProject, EclipseCompilerConfiguration.class); final Sdk projectJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); final String vmExePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk); commandLine.add(vmExePath); commandLine.add("-Xmx" + options.MAXIMUM_HEAP_SIZE + "m"); CompilerUtil.addLocaleOptions(commandLine, false); commandLine.add("-classpath"); commandLine.add(PATH_TO_COMPILER_JAR); commandLine.add(getCompilerClass()); addCommandLineOptions(commandLine, chunk, outputPath, options, useTempFile, true); }
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException { final Module module = getModule(); if (module == null) { throw new ExecutionException("Module is not specified"); } if (!isSupport(module)) { throw new ExecutionException(getNoSdkMessage()); } final ModuleRootManager rootManager = ModuleRootManager.getInstance(module); final Sdk sdk = rootManager.getSdk(); if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) { throw CantRunException.noJdkForModule(module); } return createCommandLineState(environment, module); }
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { final GrAnnotation anno = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), GrAnnotation.class, false); if (anno == null) { return false; } final String qname = anno.getQualifiedName(); if (qname == null || !(qname.startsWith(GRAB_ANNO) || GRAPES_ANNO.equals(qname))) { return false; } final Module module = ModuleUtilCore.findModuleForPsiElement(file); if (module == null) { return false; } final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk == null) { return false; } return file.getOriginalFile().getVirtualFile() != null && sdk.getSdkType() instanceof JavaSdkType; }
@Override public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) { final Collection<? extends Artifact> artifacts = ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance()); if (artifacts.isEmpty()) return; final Sdk[] jdks = BuildProperties.getUsedJdks(project); Sdk javaSdk = null; for (Sdk jdk : jdks) { if (jdk.getSdkType() instanceof JavaSdkType) { javaSdk = jdk; break; } } if (javaSdk != null) { final Tag taskdef = new Tag("taskdef", new Pair<String, String>("resource", "com/sun/javafx/tools/ant/antlib.xml"), new Pair<String, String>("uri", "javafx:com.sun.javafx.tools.ant"), new Pair<String, String>("classpath", BuildProperties .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) + "/lib/ant-javafx.jar")); generator.add(taskdef); } }
private void checkVirtualMachineVersion(VirtualMachine vm) { final String version = vm.version(); if("1.4.0".equals(version)) { DebuggerInvocationUtil.swingInvokeLater(myProject, () -> Messages.showMessageDialog(myProject, DebuggerBundle.message("warning.jdk140.unstable"), DebuggerBundle.message("title.jdk140" + ".unstable"), Messages.getWarningIcon())); } if(getSession().getAlternativeJre() == null) { Sdk runjre = getSession().getRunJre(); if((runjre == null || runjre.getSdkType() instanceof JavaSdkType) && !versionMatch(runjre, version)) { SdkTable.getInstance().getSdksOfType(JavaSdk.getInstance()).stream().filter(sdk -> versionMatch(sdk, version)).findFirst().ifPresent(sdk -> { XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("message.remote.jre.version.mismatch", version, runjre != null ? runjre.getVersionString() : "unknown", sdk.getName()), MessageType.INFO).notify(myProject); getSession().setAlternativeJre(sdk); }); } } }
public static GeneralCommandLine setupJVMCommandLine(@NotNull OwnSimpleJavaParameters javaParameters) throws CantRunException { Sdk jdk = javaParameters.getJdk(); if(jdk == null) { throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified")); } SdkTypeId type = jdk.getSdkType(); if(!(type instanceof JavaSdkType)) { throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified")); } GeneralCommandLine commandLine = new GeneralCommandLine(); ((JavaSdkType) type).setupCommandLine(commandLine, jdk); String exePath = commandLine.getExePath(); if(exePath == null) { throw new CantRunException(ExecutionBundle.message("run.configuration.cannot.find.vm.executable")); } setupCommandLine(commandLine, javaParameters); return commandLine; }
@Nullable @Override public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) { myModel = ProjectStructureConfigurable.getInstance(ProjectManager.getInstance().getDefaultProject()).getProjectJdksModel(); myJdkComboBox = new JdkComboBox(myModel, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), sdk -> true, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), true); ComboboxWithBrowseButton comboboxWithBrowseButton = new ComboboxWithBrowseButton(myJdkComboBox); FixedSizeButton setupButton = comboboxWithBrowseButton.getButton(); myJdkComboBox.setSetupButton(setupButton, null, myModel, (JdkComboBox.JdkComboBoxItem) myJdkComboBox.getModel().getSelectedItem(), null, false); return LabeledComponent.create(comboboxWithBrowseButton, "Jdk", BorderLayout.WEST); }
private void setupExeParams(final Sdk jdk, GeneralCommandLine cmdLine) throws ExecutionException { final String jdkPath = jdk != null && jdk.getSdkType() instanceof JavaSdkType ? ((JavaSdkType)jdk.getSdkType()).getBinPath(jdk) : null; if (jdkPath == null) { throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path")); } JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk); if (myConfiguration.HEAP_SIZE != null && myConfiguration.HEAP_SIZE.trim().length() != 0) { if (version == null || version.isAtLeast(JavaSdkVersion.JDK_1_2)) { cmdLine.getParametersList().prepend("-J-Xmx" + myConfiguration.HEAP_SIZE + "m"); } else { cmdLine.getParametersList().prepend("-J-mx" + myConfiguration.HEAP_SIZE + "m"); } } cmdLine.setWorkDirectory((File)null); @NonNls final String javadocExecutableName = File.separator + (SystemInfo.isWindows ? "javadoc.exe" : "javadoc"); @NonNls String exePath = jdkPath.replace('/', File.separatorChar) + javadocExecutableName; if (new File(exePath).exists()) { cmdLine.setExePath(exePath); } else { //try to use wrapper jdk exePath = new File(jdkPath).getParent().replace('/', File.separatorChar) + javadocExecutableName; if (!new File(exePath).exists()) { final File parent = new File(System.getProperty("java.home")).getParentFile(); //try system jre exePath = parent.getPath() + File.separator + "bin" + javadocExecutableName; if (!new File(exePath).exists()) { throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path")); } } cmdLine.setExePath(exePath); } }
@Override protected VirtualFile[] adjustAddedFileSet(final Component component, final VirtualFile[] files) { if (mySdk.getSdkType() instanceof JavaSdkType) { return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files); } return super.adjustAddedFileSet(component, files); }
public static void addJavaHome(@NotNull JavaParameters params, @NotNull Module module) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { String path = StringUtil.trimEnd(sdk.getHomePath(), File.separator); if (StringUtil.isNotEmpty(path)) { params.addEnv("JAVA_HOME", FileUtil.toSystemDependentName(path)); } } }
@NotNull private static Condition<Module> isGroovyCompatibleModule(final Condition<Module> condition) { return new Condition<Module>() { @Override public boolean value(Module module) { if (condition.value(module)) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { return true; } } return false; } }; }
private static boolean isCorrectModule(PsiFile file) { final Module module = ModuleUtilCore.findModuleForPsiElement(file); if (module == null) { return false; } final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk == null) { return false; } return file.getOriginalFile().getVirtualFile() != null && sdk.getSdkType() instanceof JavaSdkType; }
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); } } }
public static JavaParameters createJavaParametersWithSdk(@Nullable Module module) { JavaParameters params = new JavaParameters(); params.setCharset(null); if (module != null) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { params.setJdk(sdk); } } if (params.getJdk() == null) { params.setJdk(new SimpleJavaSdkType().createJdk("tmp", SystemProperties.getJavaHome())); } return params; }
private static void addIntellijLibraries(JavaParameters params, Sdk ideaJdk) { @NonNls String libPath = ideaJdk.getHomePath() + File.separator + "lib"; PathsList list = params.getClassPath(); for (String lib : IJ_LIBRARIES) { list.addFirst(libPath + File.separator + lib); } list.addFirst(((JavaSdkType) ideaJdk.getSdkType()).getToolsPath(ideaJdk)); }
private void setupExeParams(final Sdk jdk, GeneralCommandLine cmdLine) throws ExecutionException { final String jdkPath = jdk != null && jdk.getSdkType() instanceof JavaSdkType ? ((JavaSdkType)jdk.getSdkType()).getBinPath(jdk) : null; if (jdkPath == null) { throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path")); } JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk); if (HEAP_SIZE != null && HEAP_SIZE.trim().length() != 0) { if (version == null || version.isAtLeast(JavaSdkVersion.JDK_1_2)) { cmdLine.getParametersList().prepend("-J-Xmx" + HEAP_SIZE + "m"); } else { cmdLine.getParametersList().prepend("-J-mx" + HEAP_SIZE + "m"); } } cmdLine.setWorkDirectory((File)null); @NonNls final String javadocExecutableName = File.separator + (SystemInfo.isWindows ? "javadoc.exe" : "javadoc"); @NonNls String exePath = jdkPath.replace('/', File.separatorChar) + javadocExecutableName; if (new File(exePath).exists()) { cmdLine.setExePath(exePath); } else { //try to use wrapper jdk exePath = new File(jdkPath).getParent().replace('/', File.separatorChar) + javadocExecutableName; if (!new File(exePath).exists()){ final File parent = new File(System.getProperty("java.home")).getParentFile(); //try system jre exePath = parent.getPath() + File.separator + "bin" + javadocExecutableName; if (!new File(exePath).exists()){ throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path")); } } cmdLine.setExePath(exePath); } }
@Override public SdkPathEditor createPathEditor(final Sdk sdk) { return new SdkPathEditor(ProjectBundle.message("sdk.configure.sourcepath.tab"), OrderRootType.SOURCES, new FileChooserDescriptor(true, true, true, false, true, true)) { @Override protected VirtualFile[] adjustAddedFileSet(final Component component, final VirtualFile[] files) { if (sdk.getSdkType() instanceof JavaSdkType) { return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files); } return super.adjustAddedFileSet(component, files); } }; }
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)); }
public static void addJavaHome(@NotNull JavaParameters params, @NotNull Module module) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { String path = StringUtil.trimEnd(sdk.getHomePath(), File.separator); if (StringUtil.isNotEmpty(path)) { Map<String, String> env = params.getEnv(); if (env == null) { env = new HashMap<String, String>(); params.setEnv(env); } env.put("JAVA_HOME", FileUtil.toSystemDependentName(path)); } } }
private static List<Module> getGroovyCompatibleModules(Project project) { ArrayList<Module> result = new ArrayList<Module>(); for (Module module : ModuleManager.getInstance(project).getModules()) { if (GroovyUtils.isSuitableModule(module)) { Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { result.add(module); } } } return result; }
@Nullable public Sdk getEffectiveJDK() { if(!XsltRunSettingsEditor.ALLOW_CHOOSING_SDK) { return getDefaultSdk(); } if(myJdkChoice == JdkChoice.JDK) { return myJdk != null ? SdkTable.getInstance().findSdk(myJdk) : null; } Sdk jdk = null; final Module module = getEffectiveModule(); if(module != null) { ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); ModuleExtension maybeJavaExtension = moduleRootManager.getExtension("java"); if(maybeJavaExtension instanceof ModuleExtensionWithSdk) { jdk = ((ModuleExtensionWithSdk) maybeJavaExtension).getSdk(); } } // EA-33419 if(jdk == null || !(jdk.getSdkType() instanceof JavaSdkType)) { return getDefaultSdk(); } return jdk; }
private static void addClassPathValue(final Sdk jdk, final JavaSdkVersion version, final ParametersList parametersList, final String cpString, @NonNls final String tempFileName, List<File> tempFiles, boolean useTempFile) throws IOException { if(!useTempFile) { parametersList.add(cpString); return; } // must include output path to classpath, otherwise javac will compile all dependent files no matter were they compiled before or not if(version == JavaSdkVersion.JDK_1_0) { parametersList.add(((JavaSdkType) jdk.getSdkType()).getToolsPath(jdk) + File.pathSeparator + cpString); } else { File cpFile = File.createTempFile(tempFileName, ".tmp"); cpFile.deleteOnExit(); tempFiles.add(cpFile); final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(cpFile))); try { CompilerIOUtil.writeString(cpString, out); } finally { out.close(); } parametersList.add("@" + cpFile.getAbsolutePath()); } }
private static boolean versionMatch(@Nullable Sdk sdk, String version) { if(sdk != null && sdk.getSdkType() instanceof JavaSdkType) { String versionString = sdk.getVersionString(); return versionString != null && versionString.contains(version); } return false; }
@Override public boolean isSuitableSdkType(SdkTypeId sdkType) { return sdkType instanceof JavaSdkType; }
@Override protected boolean isValidDependency(Sdk sdk) { return sdk.getSdkType() instanceof JavaSdkType; }
@NotNull public static Pair<Sdk, JavaSdkVersion> getBuildProcessRuntimeSdk(Project project) { Sdk projectJdk = null; int sdkMinorVersion = 0; JavaSdkVersion sdkVersion = null; final Set<Sdk> candidates = new LinkedHashSet<Sdk>(); final Sdk defaultSdk = ProjectRootManager.getInstance(project).getProjectSdk(); if (defaultSdk != null && defaultSdk.getSdkType() instanceof JavaSdkType) { candidates.add(defaultSdk); } for (Module module : ModuleManager.getInstance(project).getModules()) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { candidates.add(sdk); } } // now select the latest version from the sdks that are used in the project, but not older than the internal sdk version final JavaSdk javaSdkType = JavaSdk.getInstance(); for (Sdk candidate : candidates) { final String vs = candidate.getVersionString(); if (vs != null) { final JavaSdkVersion candidateVersion = javaSdkType.getVersion(vs); if (candidateVersion != null) { final int candidateMinorVersion = getMinorVersion(vs); if (projectJdk == null) { sdkVersion = candidateVersion; sdkMinorVersion = candidateMinorVersion; projectJdk = candidate; } else { final int result = candidateVersion.compareTo(sdkVersion); if (result > 0 || (result == 0 && candidateMinorVersion > sdkMinorVersion)) { sdkVersion = candidateVersion; sdkMinorVersion = candidateMinorVersion; projectJdk = candidate; } } } } } final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) { projectJdk = internalJdk; sdkVersion = javaSdkType.getVersion(internalJdk); } return Pair.create(projectJdk, sdkVersion); }
@Override public boolean isSuitableSdkType(SdkTypeId sdkType) { boolean isJavaTemplate = myWizardState.isOnDefaultWizardPath() && NewModuleWizardState.isAndroidTemplate(myWizardState.getTemplateMetadata()); return isJavaTemplate ? sdkType instanceof JavaSdkType : AndroidSdkType.getInstance().equals(sdkType); }
@Override public boolean isSuitableSdkType(SdkTypeId sdk) { return sdk instanceof JavaSdkType; }
@NotNull private static Sdk getJdk(@Nullable Project project, MavenRunnerSettings runnerSettings, boolean isGlobalRunnerSettings) throws ExecutionException { String name = runnerSettings.getJreName(); if (name.equals(MavenRunnerSettings.USE_INTERNAL_JAVA)) { return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); } if (name.equals(MavenRunnerSettings.USE_PROJECT_JDK)) { if (project != null) { Sdk res = ProjectRootManager.getInstance(project).getProjectSdk(); if (res != null) { return res; } Module[] modules = ModuleManager.getInstance(project).getModules(); for (Module module : modules) { Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { return sdk; } } } if (project == null) { Sdk recent = ProjectJdkTable.getInstance().findMostRecentSdkOfType(JavaSdk.getInstance()); if (recent != null) return recent; return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); } throw new ProjectJdkSettingsOpenerExecutionException("Project JDK is not specified. <a href=''>Configure</a>", project); } if (name.equals(MavenRunnerSettings.USE_JAVA_HOME)) { final String javaHome = System.getenv("JAVA_HOME"); if (StringUtil.isEmptyOrSpaces(javaHome)) { throw new ExecutionException(RunnerBundle.message("maven.java.home.undefined")); } final Sdk jdk = JavaSdk.getInstance().createJdk("", javaHome); if (jdk == null) { throw new ExecutionException(RunnerBundle.message("maven.java.home.invalid", javaHome)); } return jdk; } for (Sdk projectJdk : ProjectJdkTable.getInstance().getAllJdks()) { if (projectJdk.getName().equals(name)) { return projectJdk; } } if (isGlobalRunnerSettings) { throw new ExecutionException(RunnerBundle.message("maven.java.not.found.default.config", name)); } else { throw new ExecutionException(RunnerBundle.message("maven.java.not.found", name)); } }
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)); }