eddiewang eddiewang - 11 months ago 145
Java Question

The constructor TFSTeamProjectCollection(String) is undefined

Trying to implement the Java SDK, following the tutorial here: https://blogs.msdn.microsoft.com/bharry/2011/05/16/announcing-a-java-sdk-for-tfs/

I have the libraries imported, but getting a compilation error

TFSTeamProjectCollection tpc =
new TFSTeamProjectCollection(BASEURL);

BASEURL is a string I defined earlier in the code.
The error is:
The constructor TFSTeamProjectCollection(String) is undefined

Does anyone know how to resolve this issue?

Answer Source

Well, studying the C# side of things ( see here ) I can't find a constructor that would only take a String argument.

There is only a single argument constructor taking a Uri.

In other words: the fact that you your string contains a Url; and that you named it a BASEURL doesn't magically turn it from a String into a URL or URI class object.

Guessing: the ctor wants an argument of type java.net.URL which you could probably create with something like new URL(BASEURL); instead of just passing BASEURL to that constructor.

The thing is: in order to actually understand which constructors that Team Foundation class has; one would need access to the corresponding SDK from Microsoft - which you probably downloaded and and have in place. So, the only thing that you need to do ... read the javadocs!