devonfw / ide

Tool to automate setup and update of development environment (esp. for Java projects).
Apache License 2.0
35 stars 101 forks source link

Cannot launch Eclipse anymore #1387

Closed hohwille closed 2 months ago

hohwille commented 2 months ago

Expected behavior

As a devonfw-ide user, I want to start Eclipse so that I can start coding there.

Actual behavior

image

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. devon eclipse
$ devon
devonfw-ide environment variables have been set for /d/projects/devonfw in workspace main

$ mvn -v
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: D:\projects\devonfw\software\mvn
Java version: 17.0.8, vendor: Eclipse Adoptium, runtime: D:\projects\devonfw\software\java
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

$ devon eclipse

As you can see java is properly installed but when launching eclipse via devon I get the error from the screenshot above:

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: C:/Program Files/Git/usr/bin/javaw

Related/Dependent Issues

?

Comments/Hints:

I am confused by the C:/Program Files/Git/usr/bin/javaw in the error:

echo -e ${PATH//:/\\n}
/d/projects/devonfw/software/vscode/bin
/d/projects/devonfw/software/tomcat/bin
/d/projects/devonfw/software/terraform
/d/projects/devonfw/software/sonar/bin
/d/projects/devonfw/software/python
/d/projects/devonfw/software/pip
/d/projects/devonfw/software/oc
/d/projects/devonfw/software/node_modules
/d/projects/devonfw/software/node
/d/projects/devonfw/software/mvn/bin
/d/projects/devonfw/software/lazydocker
/d/projects/devonfw/software/kotlinc/bin
/d/projects/devonfw/software/java/bin
/d/projects/devonfw/software/intellij/bin
/d/projects/devonfw/software/helm
/d/projects/devonfw/software/gradle/bin
/d/projects/devonfw/software/gh/bin
/d/projects/devonfw/software/gcviewer
/d/projects/devonfw/software/gcloud/bin
/d/projects/devonfw/software/eclipse
/d/projects/devonfw/software/dotnet
/d/projects/devonfw/software/cobigen/bin
/d/projects/devonfw/software/az/bin
/d/projects/devonfw/software/aws
/d/projects/devonfw/software/android-studio/bin
/usr/local/bin
/usr/bin
/bin
/opt/bin
...

So IMHO the /usr/bin entry is what becomes C:/Program Files/Git/usr/bin/. However, the correct location to Java bin folder is on the PATH before that.

Affected version:

hohwille commented 2 months ago

https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/eclipse#L389

hohwille commented 2 months ago

https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/command/eclipse#L33-L37

hohwille commented 2 months ago

I prefixed line 389 with an echo and got this output:

start eclipse /B /d/projects/devonfw/software/eclipse/eclipsec -clean -data /d/projects/devonfw/workspaces/main -keyring ~/.eclipse/.keyring -configuration /d/projects/devonfw/plugins/eclipse/configuration/ -vm /bin/javaw -showlocation main -vmargs

So JAVA_HOME is not set and therefore ECLIPSE_JAVA_HOME is empty.

hohwille commented 2 months ago

https://github.com/devonfw/ide/blob/cdf4af5de21489f3fdcbfdab41af858822e0d598/scripts/src/main/resources/scripts/devon.properties#L13

hohwille commented 2 months ago
$ devon
devonfw-ide environment variables have been set for /d/projects/devonfw in workspace main

$ echo $JAVA_HOME

So JAVA_HOME is empty but the line cited above is present in my local scripts/devon.properties. In IDEasy, I could call ide -d env to see if it gets overridden and where but here I need to dig deep.

hohwille commented 2 months ago

Nothing wrong in...

hohwille commented 2 months ago

OMG, I was blind but now I can see it in my settings/devon.properties:

DEVON_IDE_TOOLS=(mvn npm)
DEVON_CREATE_START_SCRIPTS=(eclipse vscode)
SETTINGS_PATH=${DEVON_IDE_HOME}/settings
export=NPM_CONFIG_USERCONFIG=${DEVON_IDE_HOME}/conf/npm/.npmrc

# Java
export=JAVA_HOME=${DEVON_IDE_HOME}/software/java

# Maven
#export M2_REPO=~/.m2/repository
export=M2_REPO=${DEVON_IDE_HOME}/conf/.m2/repository
export=MAVEN_HOME=${DEVON_IDE_HOME}/software/mvn
export=MAVEN_OPTS=-Duser.home=${DEVON_IDE_HOME}/conf
export=COBIGEN_HOME=${DEVON_IDE_HOME}/conf/.cobigen
export=JENKINS_HOME=${DEVON_IDE_HOME}/conf/.jenkins
DOCKER_EDITION=rancher

After export there always is a = instead of a `. So this is not a bug of devonfw-ide but the question is where does this come from. If it was not inscripts/devon.propertiesI would question if IDEasy broke this during alpha testing but it does not know or care about thescripts` folder at all.

So I assume that I did something wrong locally (some shell scripting went wild). As I cannot reproduce this, I will close this as invalid. Whenever the error comes back, we can analyze the root cause and reopen.

hohwille commented 2 months ago

However, as a learning in IDEasy we should better verify things and should log warning/error(s) if a required variable is empty.