Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 48449  / 2 Years ago, sat, april 23, 2022, 10:50:06

When I create a .desktop file to launch eclipse (latest build with JDK 1.8 support) I get the following error:



A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/home/dean/bin/eclipse-standard-luna-M5-linux-gtk-x86_64/eclipse/jre/bin/java
java in your current PATH


Why does it try to find the JRE under the directory where the eclipse binary is?



I can launch Eclipse from the command line, and I can pin it to the launcher and it works. Why is the .desktop file so confused about what it is supposed to do?



Here is my .desktop file:



[Desktop Entry]
Version=1.0
Name=Eclipse JDK 1.8
Comment=Eclipse
Exec=/home/dean/bin/eclipse-standard-luna-M5-linux-gtk-x86_64/eclipse/eclipse
Icon=/home/dean/bin/eclipse-standard-luna-M5-linux-gtk-x86_64/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=Utility;Application;


The problem I'm having is not what was asked in the question linked above as a duplice. My issue is because my PATH to the JDK is set in my .bashrc.


More From » eclipse

 Answers
5

I've copied the following block from within the if [ -n "$BASH_VERSION" ]; then statement:



if [ -f "$HOME/.bashrc_" ]; then
. "$HOME/.bashrc"
fi


I've also tried without the if statement:



. "$HOME/.bashrc"


but Eclipse fails with the same error message in both cases. Apparently HOME isn't set when lightdm runs ~/.profile.



Explicitly setting the path in ~/.profile works, but I want to keep my PATH and my other Bash features (aliases, functions) in the same file.



The solution is to set the PATH on the Exec=env PATH=$PATH:... line in eclipse.desktop. Nothing I've tried works to start IntelliJ from a desktop icon, however.



Given that you are reinventing the Linux GUI experience with Unity maybe it's time to leave the error prone series of scripts behind and use something that is less error prone and easier to use. The scripts would still have to be there for bash shells, but the Unity desktop could be independent of them.


[#27083] Sunday, April 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
needstar

Total Points: 268
Total Questions: 108
Total Answers: 117

Location: Seychelles
Member since Mon, Jun 28, 2021
3 Years ago
;