Giter VIP home page Giter VIP logo

Comments (10)

ericbottard avatar ericbottard commented on May 30, 2024

This is likely because you're running maven with a JRE, not a JDK.

Although this should work on most platforms, it seems it does not work on yours.

  • What does ./mvnw -v emit?
  • What is the layout of F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre on your machine?

from spring-cloud-deployer-local.

KingRokHead avatar KingRokHead commented on May 30, 2024

Hi.

What is the layout of F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre on your machine?

The layout of my ...\jre is bin, lib plus all other child files under the jre directory - the original layout and content of the java distribution. There is no bin\java
This is not (in my opinion) an environment issue as I already performed all the necessary Googling to figure out why I was seeing the observed problems which led me to this class.
My JAVA_HOME is set correctly. "java.home" refers to JRE_HOME (Oracle documentation). My jdk bin is on my PATH out in front.

What does ./mvnw -v emit?

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: F:\lib-tools\tools\maven\apache-maven-3.5.0-bin\bin..
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "x86", family: "windows"

I stepped through the code and the toString of File returns "F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre\bin\java" which points to a non-existent file

Although this should work on most platforms, it seems it does not work on yours.

I'm not sure how the below test harness works on most platforms other then failing on the assertion.

I created a quick and simple test harness to demonstrate the behavior.

`
package com.tdt;
import java.io.File;
import org.junit.Assert;

public class TestJavaHome {
public static String JAVA_COMMAND = "java";
public static String JAVA_COMMAND_EXE = "java.exe";

public static void main(String[] args){
	String javaExecutablePath = JAVA_COMMAND;
	String javaHome = System.getProperty("java.home");
	File javaExecutable = new File(javaHome, "bin/" + javaExecutablePath);
	Assert.assertTrue("Java executable discovered via 'java.home' system property '" + javaHome + "' is not executable or does not exist.", javaExecutable.canExecute());
}

}`

The failed assertion is what is causing the tests to fail when running maven and ultimately the build to fail (although I know I can skip the tests).
The key point here is that "java" (without the file extension) points to nothing. If this is intended behavior then please explain the apparent incorrect purpose as it currently exists in the code base.

Thanks.

from spring-cloud-deployer-local.

ericbottard avatar ericbottard commented on May 30, 2024

In most java tool installations, JAVA_HOME is meant to point to a JDK installation (not a JRE).
I recommend changing this (at least for the session / script) that you use to launch SCDF

from spring-cloud-deployer-local.

KingRokHead avatar KingRokHead commented on May 30, 2024

Hi.

My JAVA_HOME is set to "F:\lib-tools\libs\java\jdk-1.8.0_60_x64" - the JDK. Which is the correct path for JAVA_HOME. It is not set to "F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre" which is what I think is your assumption.

There is no:

  • F:\lib-tools\libs\java\jdk-1.8.0_60_x64\java, or
  • F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre\java or
  • F:\lib-tools\libs\java\jdk-1.8.0_60_x64\bin\java or
  • F:\lib-tools\libs\java\jdk-1.8.0_60_x64\jre\bin\java

ON a Windows environment, the code I provided above executes the same code in LocalDeployerProperties.java.

As it is coded the assertion will never hold true.

Am I missing something? Perhaps you could execute the main method I provided above, observe the results and tell me your execution passes true?

Or could you possibly explain why setting JAVA_COMMAND to "java" instead of "java.exe" is correct.

Thanks for your time.

from spring-cloud-deployer-local.

ericbottard avatar ericbottard commented on May 30, 2024

My bad, I did not even realize there was the .exe extension problem.

LocalDeployerProperties being a @ConfigurationProperties class, you can override the value by setting eg the environment variable SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD

from spring-cloud-deployer-local.

ericbottard avatar ericbottard commented on May 30, 2024

Please, could you confirm the above solution suits your needs? If so, feel free to close this issue.
Thanks

from spring-cloud-deployer-local.

sabbyanandan avatar sabbyanandan commented on May 30, 2024

Hi, @KingRokHead: It'd be great if you can share your findings and close the issue.

from spring-cloud-deployer-local.

KingRokHead avatar KingRokHead commented on May 30, 2024

Hey,
Apologies for not responding sooner as I have been in the process of moving.

LocalDeployerProperties being a @ConfigurationProperties class, you can override the value by setting eg the environment variable SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD

I will try the above work around within the week.

from spring-cloud-deployer-local.

manueljordan avatar manueljordan commented on May 30, 2024

Hello

I did the following combinations in the same console:

For JDK

  • SET SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD=C:\whiteroom\java\jdk1.8.0_131\bin
  • SET SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD=C:\whiteroom\java\jdk1.8.0_131\bin;%PATH%

For JRE

  • SET SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD=C:\whiteroom\java\jre1.8.0_131\bin
  • SET SPRING_CLOUD_DEPLOYER_LOCAL_JAVA_CMD=C:\whiteroom\java\jre1.8.0_131\bin;%PATH%

For any of these possible 4 options, I got the same issue yet.

Not sure if I am doing something wrong

from spring-cloud-deployer-local.

jvalkeal avatar jvalkeal commented on May 30, 2024

@ericbottard btw, I just PR'd #58 which relates to this.

from spring-cloud-deployer-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.