4

I installed Pycharm, which automatically created then a shortcut at the Applications Menu. But the shortcut does not work and shows the message

No JDK found. Please validate either PYCHARM_JDK, JDK_HOME or JAVA_HOME    environment variable points to valid JDK installation.

But Java is installed:

java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode).

Besides, if I run the script "pycharm.sh" from the command line, it works.

dufte
  • 14,198
  • 5
  • 41
  • 43
cerebrou
  • 476

4 Answers4

3

I had this issue today myself. I installed pycharm via getdeb repository so my installation folder is located at: /usr/share/pycharm/bin. In order to fix this issue steps are:

  1. sudo gedit or sudo xed /usr/share/pycharm/bin/pycharm.sh
  2. find Line: JDK=`update-alternatives --list java | grep java-8 | sed 's,jre/bin/java,,' and replace it with JDK = '/usr/lib/jvm/java-8-oracle/' or JDK = '/usr/lib/jvm/java-8-openjdk-amd64/' if you're using openjdk.
  3. Save and exit, then try running pycharms again. You should be good to go.
answerSeeker
  • 901
  • 3
  • 11
  • 26
1

Add the following line to .bashrc/.profile. This worked for me.

export PYCHARM_JDK=$JAVA_HOME
export PYSPARK_SUBMIT_ARGS="--master local[2] pyspark-shell"

Assuming you have set JAVA_HOME. If not, use path to Java home directory.

pMan
  • 111
1

I had the same issue, and I fixed it by doing:

# Open & modify pycharm's executable
sudo nano /usr/share/pycharm/bin/pycharm.sh
# Edit line: 95
JDK=`update-alternatives --get-selections | grep "java " | awk '{gsub("/bin/java", ""); print $3}'`
TheOdd
  • 3,012
0

If you don't mind installing a snap, you can also try:

sudo snap install pycharm-community --classic

Start it (the first time) from a terminal with

pycharm-community

After closing, search for it in the dash and drag the icon to the launcher.

lapisdecor
  • 1,647
  • 5
  • 19
  • 39