Exporting metrics to publichost using Java client

I am using Java Client to expose metrics. In my localhost.com:8484/metrics I can see my metrics. Do I have to use metricsservlet and how does it work
When I run my application:

public class CustomApp{

    public static void main(String[] args) {

        SpringApplication.run(CustomApp.class, args);
        try {
            HTTPServer server = new HTTPServer.Builder()
        } catch() ...

things seem to work fine as I get no error and it doesn’t enter the catch block. However, when I try to find the metrics on publichost.com/8484/metrics it doesnt find the endpoint or point.
Any idea on what I’m missing?