Intellij IDea installation path not able to fetch programmatically

Answered

Please let me know where we can get the installation path of intellij idea community path programmatically.. I have tried PathManager.getHomepath and no luck..

it returns as below.C:\Users\Pallavi.Pallavi\.gradle\caches\modules-2\files-2.1\com.jetbrains.intellij.idea\ideaIC\2020.1\cbeeb1f1aebd4c9ea8fb5ab990c5904a676fc41a\ideaIC-2020.1

 

I wanted to return as below

C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1. . Sadly its not returning this way.

Kindly help me urgently.

 

0
8 comments

Did you test it running IDE with Gradle task? If so - it uses Gradle dependencies, so the output is expected. Try to specify the alternativeIdePath in your Gradle settings to use the IDE instance installed in your OS to test the "real" installation path.

0

Kindly help me with documentation of setting the alternativeidepath in gradle settings

0

Have you checked the gradle-intellij-plugin main page? It's documented right in the README file.

0

Thanks Jakub Chrzanowski for the reply. I even tried implementing the same and we are getting the expected output. But then we have a issue where the plugin which we are creating will be given to the end user and he will be giving any path for his installation of the intellij idea and that path cannot be mentioned in build. gradle  and will throw and error . Do you have any alternate solution where we can get the IDE installation path without using alternativeIde path?

0

This solution is for running and debugging your plugin using the custom IDE path that the one downloaded with Gradle.

What's your goal in general? You should avoid playing with the IDE installation path.

0

Ultimate goal is we will be placing the plugin in plugins folder of IDE instllation path so that it will be avaibale for the users of intellij idea. So during that for our project we need the paths of the plugin folder of IDE installation path to check for few validations like enabling and disabling the plugin. IS there any alternate place where the user can place the plugin so that it will be available?. 

0

For your plugin users (If you plan on not publishing to https://plugins.jetbrains.com/) you can do one of the following. Atleast this is what I'm doing. 

  1. You can host the plugin zip in your own server from which the users can download. Refer:https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/update_plugins_format.html
  2. Or you can generate a .zip / .jar file by running gradle :assemble task. And simple ask your users to drag and drop the file in intellij to get it installed. 

Happy Coding :)

 

0

Abhaydoshi7: Yes we are not currently planning to host it to jetbrains.It will be in one our internal servers. But users need to place it in plugin folder and license in license folder of IDE installation path. Also we have a custom coding for licensing of the jar where we need these paths were we got stuck. Now since ide path is mentioned as alternative ide path. we are planning for the users to give IDE installation path so that our code can work. Since the entire licensing code requires this path..

0

Please sign in to leave a comment.