Example usage for java.net URL URL

List of usage examples for java.net URL URL

Introduction

In this page you can find the example usage for java.net URL URL.

Prototype

public URL(String spec) throws MalformedURLException 

Source Link

Document

Creates a URL object from the String representation.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    URL url = new URL("jar:file:/c://my.jar!/com/mycompany/MyClass.class");
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    URL url = new URL("jar:file:/c://my.jar!/");
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    URL url = new URL("http://hostname:80/index.html");
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    URL url = new URL("http://java2s.com:80/index.html");
    System.out.println(url.toURI());
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    URL u = new URL("http://www.java2s.com");
    Object o = u.getContent();/*  w  w w .  j av a2s  . c  o m*/
    System.out.println(o.getClass().getName());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    URL url = new URL("http://java2s.com:80/index.html");
    System.out.println(url.toString());
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    URL u = new URL("http://www.yourserver.com:80/abc/demo.htm");
    System.out.println("The URL is " + u);
    System.out.println("The ref part is " + u.getRef());

}

From source file:Main.java

public static void main(String args[]) throws Exception {
    URL u = new URL("http://www.yourserver.com:80/abc/demo.htm");
    System.out.println("The URL is " + u);
    System.out.println("The file part is " + u.getFile());

}

From source file:Main.java

public static void main(String args[]) throws Exception {
    URL u = new URL("http://www.yourserver.com/abc/demo.htm");
    System.out.println("The URL is " + u);
    System.out.println("The host part is " + u.getHost());

}

From source file:Main.java

public static void main(String args[]) throws Exception {
    URL u = new URL("http://www.yourserver.com:80/abc/demo.htm");
    System.out.println("The URL is " + u);
    System.out.println("The path part is " + u.getPath());

}