spen123
spen123

Reputation: 3524

Generate module-info using jlink for an external JAR

I have a simple hello world java application, I have manually downloaded org.json and added it to my classpath so the below app runs. How can I make a custom JRE to run this app that include the jar?

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Go {

    public static void main(String[] args) {

        SpringApplication.run(MessagingStompWebsocketApplication.class, args);
        System.out.println("running");


    }

}

Not sure how to get past jdeps returning not found

jdeps --add-modules java.base,java.logging --generate-module-info work in/spring-jcl-5.2.3.RELEASE.jar 
Missing dependence: work/spring.jcl/module-info.java not generated
Error: missing dependencies
spring.jcl
   org.apache.commons.logging.LogAdapter$Log4jLog     -> org.apache.logging.log4j.Level                     not found
   org.apache.commons.logging.LogAdapter$Log4jLog     -> org.apache.logging.log4j.LogManager                not found
   org.apache.commons.logging.LogAdapter$Log4jLog     -> org.apache.logging.log4j.Marker                    not found
   org.apache.commons.logging.LogAdapter$Log4jLog     -> org.apache.logging.log4j.spi.ExtendedLogger        not found
   org.apache.commons.logging.LogAdapter$Log4jLog     -> org.apache.logging.log4j.spi.LoggerContext         not found
   org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.Logger                                   not found
   org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.LoggerFactory                            not found
   org.apache.commons.logging.LogAdapter$Slf4jAdapter -> org.slf4j.spi.LocationAwareLogger                  not found
   org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.Logger                                   not found
   org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.Marker                                   not found
   org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog -> org.slf4j.spi.LocationAwareLogger                  not found
   org.apache.commons.logging.LogAdapter$Slf4jLog     -> org.slf4j.Logger                                   not found

And they dont work for spring

These do not answer my questions, as none of them show how to make the custom JRE.

creating module-info for automatic modules with jdeps in java 9

Is there a way to add maven dependencies while using the maven-jlink-plugin?

This generates a module-info.java and module-info.class and have been referencing this https://www.baeldung.com/jlink to try to figure how to get my custom jre but I am stuck here.

Thank you

Upvotes: 3

Views: 1796

Answers (1)

Rocky
Rocky

Reputation: 527

I generated the module-info.java through the help of my ide. I am using STS 4.6.2. I just right-clicked on my project -> configure -> Create module-info.jar. Then if you're using maven, just do a clean install and the module-info.class will be generated. Hope this helps.

Upvotes: 0

Related Questions