I´m searching for a opportunity to open a url in java.
URL url = new URL("http://maps.google.at/maps?saddr=4714&daddr=Marchtrenk&hl=de");
InputStream is = url.openConnection().getInputStream();
BufferedReader reader = new BufferedReader( new InputStreamReader( is ) );
String line = null;
while( ( line = reader.readLine() ) != null ) {
System.out.println(line);
}
reader.close();
I found that way.
I added it in my program and the following error occurred.
The method openConnection() is undefined for the type URL
(by url.openConnection())
What is my problem?
I use a tomcat-server with servlets, ...
java.net.URL
but some other class calledURL
. – Folie