Closed stevebeauge closed 2 days ago
As a workaround, I downloaded the latest openjdk and tweak the env before running the cli:
$newPath = $env:Path.split(";") | ? { $_ -notmatch "java" } -join ";"
$newPath += ";C:\Users\steve\Downloads\openjdk-22.0.1_windows-x64_bin\jdk-22.0.1"
$env:Path = $newPath
$env:JAVA_HOME = "C:\Users\steve\Downloads\openjdk-22.0.1_windows-x64_bin\jdk-22.0.1"
openapi-generator-cli version --full
Produces:
openapi-generator-cli 7.6.0
commit : ab7d0cb
built : -999999999-01-01T00:00:00+18:00
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/
It may unblock my one time command, but it's not viable for day to day usage
java version "1.8.0_411"
we no longer support jdk8
please use JDK 11 or newer versions
another way is to use Docker CLI: https://hub.docker.com/r/openapitools/openapi-generator-cli
My java installation is up to date :
if jdk or anything else has to be installed, it should be stated in the doc
what JDK version are you using now?
As I said, I'm not a java developer, so I'll explain in my own words.
I installed java latest version from oracle website.
After trying to use the generator, I search the web and found some jdk related issues, so I gave a chance to openjdk (as stated in my previous comment by unziping and overriding the paths), which is v22.
So I've version 1.18 of java, v 22 of openjdk and now I don't get any class version error of whatever it means with version unrelated to java version.
so everything works for you now, right?
I worked around yes. But the point is that the doc isn't clear regarding the requirements, and I guess it would be nice to have a clear list of prerequisites.
thanks for the feedback. updated README in https://github.com/OpenAPITools/openapi-generator-cli with JDK11 as the minimal version supported
have a nice weekend
Thanks for the support and the update.
Bug Report Checklist
Description
The cli does not works on windows because of some weird java issues.
The CLI installation page does not mention any prerequisite.
The @openapitools/openapi-generator-cli only say
java
should be installed and available on path.The documentation seems to be incomplete regarding the actual setup requirements.
Side note: I don't know how java works, maybe I miss something that should be obvious for java dev.
openapi-generator version
Latest (2.13.4)
OpenAPI declaration file content or url
Does not matter
Generation Details
Steps to reproduce
Install the cli using pnpm
Run it
Result:
I do have the latest java runtime installed:
Related issues/PRs
Found this issue: https://github.com/OpenAPITools/openapi-generator/pull/14177 with the same error, but don't see any related resolution.
Suggest a fix