Swagger CodeGen swagger-codegen-cli-3.0.25.jar| issue:Can't load config class with name jaxrs-jersey
Hi, I am trying to generate Swagger Stubs from within the java code through swagger-codegen-cli-3.0.25.jar using ProcessBuilder. Input is OAS 3.0.0 valid YAML.
I have the following code :
String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
List<String> command = new ArrayList<>();
command.add(javaBin);
command.add("-jar");
command.add(System.getProperty("user.dir")+"//lib//swagger-codegen-cli-3.0.25.jar");
command.add("generate");
command.add("-l jaxrs-jersey");
command.add("-i " + oasYAML.getAbsolutePath());
command.add("-o D:\\EmailStatement\\swaggercode");
Same CLI command works fine from CMD, but getting below error from within java code :
Exception in thread "main" java.lang.RuntimeException: Can't load config class with name jaxrs-jersey Available: dart
aspnetcore
csharp
csharp-dotnet2
go
go-server
dynamic-html
html
html2
java
jaxrs-cxf-client
jaxrs-cxf
inflector
jaxrs-cxf-cdi
jaxrs-spec
jaxrs-jersey
jaxrs-di
jaxrs-resteasy-eap
jaxrs-resteasy
micronaut
spring
nodejs-server
openapi
openapi-yaml
kotlin-client
kotlin-server
php
python
python-flask
r
ruby
scala
scala-akka-http-server
swift3
swift4
swift5
typescript-angular
typescript-axios
typescript-fetch
javascript
at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
at io.swagger.codegen.v3.cli.SwaggerCodegen.main(SwaggerCodegen.java:96)
Caused by: java.lang.ClassNotFoundException: jaxrs-jersey
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)