- java.lang.Object
- 
- javafx.application.HostServices
 
- 
 public final class HostServices extends Object This class provides HostServices for an Application. This includes methods to get the code base and document base for an Application, and to show a web page in a browser.- Since:
- JavaFX 2.0
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCodeBase()Gets the code base URI for this application.StringgetDocumentBase()Gets the document base URI for this application.StringresolveURI(String base, String rel)Resolves the specified relative URI against the base URI and returns the resolved URI.voidshowDocument(String uri)Opens the specified URI in a new browser window or tab.
 
- 
- 
- 
Method Detail- 
getCodeBasepublic final String getCodeBase() Gets the code base URI for this application. This method returns the directory containing the application jar file. If the application is not packaged in a jar file, this method returns the empty string.- Returns:
- the code base URI for this application.
 
 - 
getDocumentBasepublic final String getDocumentBase() Gets the document base URI for this application. This method returns the URI of the current directory.- Returns:
- the document base URI for this application.
 
 - 
resolveURIpublic final String resolveURI(String base, String rel) Resolves the specified relative URI against the base URI and returns the resolved URI.Example: HostServices services = getHostServices(); String myImage = services.resolveURI(services.getDocumentBase(), "image.jpg"); Image image = new Image(myImage);- Parameters:
- base- the base URI against which to resolve the relative URI
- rel- the relative URI to be resolved
- Returns:
- the fully resolved URI.
- Throws:
- NullPointerException- if either the- baseor the- relstrings are null.
- IllegalArgumentException- if there is an error parsing either the- baseor- relURI strings, or if there is any other error in resolving the URI.
 
 - 
showDocumentpublic final void showDocument(String uri) Opens the specified URI in a new browser window or tab. The determination of whether it is a new browser window or a tab in an existing browser window will be made by the browser preferences. Note that this will respect the pop-up blocker settings of the default browser; it will not try to circumvent them.- Parameters:
- uri- the URI of the web page that will be opened in a browser.
 
 
- 
 
-