Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make Intellj use my environment variables?

My PATH and JAVA_HOME are defined in ~/.bashrc.

However, when I launch Intellij from my Favorite icon and then launch a Maven Run Configuration, these variables are not thus defined. f I run the same idea.sh that is run from the Favorites icon, then they are recognized.

My pom.xml does some exec, so having these environment variables is essential.

The setting for "Include System Environment Variables" is checked. (As a test, I previously defined env variable FOOBAR-- we see it is missing here.) [env vars].

How can I make this happen automatically, even when I use the Favorites icon? The desktop file is given below.

[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Ultimate Edition
Icon=/hdd/executables/idea-IU-191.6707.61/bin/idea.svg
Exec="/hdd/executables/idea-IU-191.6707.61/bin/idea.sh" %f
Comment=Capable and Ergonomic IDE for JVM
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
like image 310
Joshua Fox Avatar asked May 20 '19 18:05

Joshua Fox


People also ask

How do I pass an environment variable in IntelliJ?

Add environment variablesFrom the main menu, select Run | Edit Configurations or choose Edit Configurations from the run/debug configurations selector on the toolbar. In the Run/Debug Configurations dialog, select a configuration you want to add the environment variables to.

How do I assign a variable in IntelliJ?

If you want to reassign the existing variable to a new one, press Ctrl+Alt+V . If you have more than one existing variable, IntelliJ IDEA displays a list to choose from. You can press Shift+Tab to change a type of the variable.


1 Answers

  • Go to Build, Execution and Deployment -> Build Tools -> Maven -> Runner -> Environment
  • Find a little icon on the right edge of Environment Variables text box.
  • On a pop-up widnow, check Include System Environment Variables
like image 58
Lesiak Avatar answered Oct 10 '22 03:10

Lesiak