2

I am working on a jersey service. When I import java.nio.file then I get a problem with the @Path annotation and the Path interface in NIO.

The error is "type ambiguous", what makes sense to me. But I do not know how to resolve it.

import javax.ws.rs.*;
import java.nio.file.*;   // problem with @PATH

@Path ("service")
public class Service 
{ 
        @GET
        @Produces(MediaType.TEXT_HTML)
        public String getIt () 
        {
            return "blabla";
        }
}

I am not an expert with annotations and need a little help here. Thanks!

Sazzadur Rahaman
  • 6,938
  • 1
  • 30
  • 52
chris01
  • 10,921
  • 9
  • 54
  • 93
  • Does not help - I need java.nio.file.Path :-) – chris01 Jul 18 '18 at 18:58
  • Do you have different java versions installed and accidentally mixed them? If so, then maybe this can help you: https://stackoverflow.com/a/20029301/9818506 – Rene Knop Jul 18 '18 at 19:00

1 Answers1

3

You can use fully qualified class names to avoid the conflict. For example, replace @Path with @javax.ws.rs.Path and Path with java.nio.file.Path.

Sazzadur Rahaman
  • 6,938
  • 1
  • 30
  • 52