override fun createJavaParameters()

in plugin-bazel/src/main/kotlin/org/jetbrains/bazel/intellij/IntellijPluginRunHandler.kt [75:123]


      override fun createJavaParameters(): JavaParameters {
        val ideaJdkHome = checkNotNull(ideaJdk.homePath)

        val params = JavaParameters()
        fillParameterList(params.programParametersList, state.programArguments)

        val vm = params.vmParametersList

        fillParameterList(vm, state.javaVmOptions)

        vm.defineProperty(PathManager.PROPERTY_CONFIG_PATH, canonicalSandbox + File.separator + "config")
        vm.defineProperty(PathManager.PROPERTY_SYSTEM_PATH, canonicalSandbox + File.separator + "system")
        vm.defineProperty(PathManager.PROPERTY_PLUGINS_PATH, canonicalSandbox + File.separator + "plugins")

        if (!vm.hasProperty("jdk.module.illegalAccess.silent")) {
          vm.defineProperty("jdk.module.illegalAccess.silent", "true")
        }

        // use product-info.json values if found, otherwise fallback to defaults
        val productInfo =
          loadProductInfo(ideaJdkHome) ?: throw ExecutionException(BazelPluginBundle.message("plugin.runner.idea.product.null"))
        productInfo.getCurrentLaunch().additionalJvmArguments.forEach { item ->
          vm.add(resolveIdeHomeVariable(item, ideaJdkHome))
        }

        if (SystemInfo.isMac) {
          vm.defineProperty("apple.awt.fileDialogForDirectories", "true")
        }

        vm.defineProperty(SlowOperations.IDEA_PLUGIN_SANDBOX_MODE, "true")

        params.workingDirectory = ideaJdkHome + File.separator + "bin" + File.separator
        params.jdk = ideaJdk

        val additionalBootClassPathJarNames = listOf("nio-fs.jar") // For some reason it's missing from the ProductInfo parsed by DevKit
        for (path in productInfo.getCurrentLaunch().bootClassPathJarNames + additionalBootClassPathJarNames) {
          params.classPath.add(ideaJdkHome + FileUtil.toSystemDependentName("/lib/$path"))
        }

        for (moduleJarPath in productInfo.getProductModuleJarPaths()) {
          params.classPath.add(ideaJdkHome + FileUtil.toSystemIndependentName("/$moduleJarPath"))
        }

        params.classPath.addFirst((ideaJdk.sdkType as JavaSdkType).getToolsPath(ideaJdk))

        params.mainClass = "com.intellij.idea.Main"

        return params
      }