Coder Social home page Coder Social logo

Comments (9)

mlynch avatar mlynch commented on June 5, 2024 1

You just set it to wherever you have java installed, using the proper directory for JAVA_HOME https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html

from trapeze.

mlynch avatar mlynch commented on June 5, 2024

Can you try setting JAVA_HOME to C:\Program Files\Git\Library\Java\JavaVirtualMachines\jdk-15.0.2.jdk\Contents\Home and see if that works?

from trapeze.

hughknaus avatar hughknaus commented on June 5, 2024

@mlynch
Ahhh that's my problem, I don't have that path on my Windows machine (I don't have the Library folder onwards).

I believe the default location for Java on Windows gets installed to a different path (I'm pretty sure I just did the default installation without changing paths) and so JAVA_HOME is:

C:\Users\hknaus>echo %JAVA_HOME%
C:\Program Files\Java\jdk-15.0.2\bin

If Trapeze is expecting the other path that you provided it would never work on Windows or I'm going to need to check the operation system that I'm building on and switch paths accordingly... or am I missing something else?

In our CI/CD scripts (which run on a Mac) we do set JAVA_HOME to /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home (in case there are multiple instances installed and the machine's default is the latest version).

from trapeze.

hughknaus avatar hughknaus commented on June 5, 2024

User error. Different environment, different JAVA_HOME paths.

from trapeze.

mlynch avatar mlynch commented on June 5, 2024

Glad it's working, cheers

from trapeze.

hughknaus avatar hughknaus commented on June 5, 2024

@mlynch I had two version of the JDK on my Windows machine (15.0.2, i.e. the one I need to use for this app, and 19).

javac -version kept returning 19, regardless of me setting JAVA_HOME to 15 or not.

So I figured I would uninstall 19 altogether and that would solve the issue, but it didn't. I still have the same issue so I closed this prematurely.

This is what I'm showing:

C:\Users\hknaus>java -version
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

C:\Users\hknaus>javac -version
javac 15.0.2

C:\Users\hknaus>echo %JAVA_HOME%
C:\Program Files\Java\jdk-15.0.2\bin

C:\Users\hknaus>

The error is slightly different, looks like an additional \bin\java is being appended to the JAVA_HOME path somewhere:

run android packageName com.Accurence.Assist
run android versionName 8.17.12
Fatal error: Error running command
Error: Unable to load or parse gradle file: Error: spawn C:\Program Files\Java\jdk-15.0.2\bin\bin\java ENOENT
    at GradleFile.parse (C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\project\dist\android\gradle-file.js:228:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async GradleFile.replaceProperties (C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\project\dist\android\gradle-file.js:53:9)
    at async executeOperations (C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\configure\dist\tasks\run.js:52:10)
    at async runCommand (C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\configure\dist\tasks\run.js:31:9)
    at async C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\configure\dist\index.js:58:13
    at async Command.<anonymous> (C:\Users\hknaus\AppData\Local\npm-cache\_npx\14f6b2623fe0959a\node_modules\@trapezedev\configure\dist\util\cli.js:31:13)

from trapeze.

hughknaus avatar hughknaus commented on June 5, 2024

@mlynch It looks like \bin\Java is being added to JAVA_HOME on line 399 of gradle-file.js which is line 510 in gradle-file.ts https://github.com/ionic-team/trapeze/blob/main/packages/project/src/android/gradle-file.ts

from trapeze.

mlynch avatar mlynch commented on June 5, 2024

Don't add bin to the end of JAVA_HOME

from trapeze.

hughknaus avatar hughknaus commented on June 5, 2024

I swear there was something else that required the \bin on the path but I guess I'll find that one at a later time. ;)

@mlynch Thank you again, it's now running fine!

from trapeze.

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.