Click here to Skip to main content
12,699,214 members (24,713 online)
   

Java

 
Questionhelp me please Pin
terzasek13-Jan-13 18:10
memberterzasek13-Jan-13 18:10 
AnswerRe: help me please Pin
Richard MacCutchan13-Jan-13 23:23
mvpRichard MacCutchan13-Jan-13 23:23 
AnswerRe: help me please Pin
Avidwan14-Jan-13 5:41
memberAvidwan14-Jan-13 5:41 
GeneralRe: help me please Pin
Richard MacCutchan14-Jan-13 7:22
mvpRichard MacCutchan14-Jan-13 7:22 
GeneralRe: help me please Pin
cubocik16-Jan-13 1:40
membercubocik16-Jan-13 1:40 
QuestionWebpage saver -- help Pin
cubocik13-Jan-13 8:38
membercubocik13-Jan-13 8:38 
SuggestionRe: Webpage saver -- help Pin
Richard MacCutchan13-Jan-13 23:18
mvpRichard MacCutchan13-Jan-13 23:18 
GeneralRe: Webpage saver -- help Pin
cubocik14-Jan-13 6:51
membercubocik14-Jan-13 6:51 
Code:

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class webpagesaver{
public static void main(String[] args) throws IOException{


String saveFile = "PaginaCopiada.html"; //name of SaveFile
String location = "http://www.sapo.pt"; // website url withou #
URL url = new URL(location);
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
conn.connect();
BufferedWriter out = new BufferedWriter(new FileWriter(saveFile));
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String l = out.readLine();
while(l!=null){
out.write(l);
out.newLine();
}
in.close();
out.close();

}
}




Compiling messages

Code:

URLConnection conn = url.openConnection();
^
  symbol:   class URLConnection
  location: class webpagesaver
webpagesaver.java:19: error: cannot find symbol
InputStream is = conn.getInputStream();
^
  symbol:   class InputStream
  location: class webpagesaver
webpagesaver.java:23: error: cannot find symbol
String l = out.readLine();
              ^
  symbol:   method readLine()
  location: variable out of type BufferedWriter
3 errors


Edit/Delete Message
GeneralRe: Webpage saver -- help Pin
Richard MacCutchan14-Jan-13 7:12
mvpRichard MacCutchan14-Jan-13 7:12 
GeneralRe: Webpage saver -- help Pin
cubocik14-Jan-13 7:34
membercubocik14-Jan-13 7:34 
GeneralRe: Webpage saver -- help Pin
cubocik14-Jan-13 7:39
membercubocik14-Jan-13 7:39 
GeneralRe: Webpage saver -- help Pin
Richard MacCutchan14-Jan-13 7:55
mvpRichard MacCutchan14-Jan-13 7:55 
GeneralRe: Webpage saver -- help Pin
cubocik14-Jan-13 8:55
membercubocik14-Jan-13 8:55 
GeneralRe: Webpage saver -- help Pin
Richard MacCutchan14-Jan-13 23:02
mvpRichard MacCutchan14-Jan-13 23:02 
GeneralRe: Webpage saver -- help Pin
cubocik16-Jan-13 1:38
membercubocik16-Jan-13 1:38 
GeneralRe: Webpage saver -- help Pin
Richard MacCutchan16-Jan-13 1:51
mvpRichard MacCutchan16-Jan-13 1:51 
QuestionHow to Record Audio at client Side? Pin
Mrugrajsinh13-Jan-13 8:19
memberMrugrajsinh13-Jan-13 8:19 
Questioncode error Pin
Member 975139812-Jan-13 13:47
memberMember 975139812-Jan-13 13:47 
AnswerRe: code error Pin
Richard MacCutchan13-Jan-13 0:35
mvpRichard MacCutchan13-Jan-13 0:35 
QuestionRegarding Maven and Jenkins Pin
sivaKrishna joga2-Jan-13 23:47
membersivaKrishna joga2-Jan-13 23:47 
AnswerRe: Regarding Maven and Jenkins Pin
Richard MacCutchan3-Jan-13 1:12
mvpRichard MacCutchan3-Jan-13 1:12 
GeneralRe: Regarding Maven and Jenkins Pin
sivaKrishna joga3-Jan-13 1:23
membersivaKrishna joga3-Jan-13 1:23 
GeneralRe: Regarding Maven and Jenkins Pin
Richard MacCutchan3-Jan-13 2:06
mvpRichard MacCutchan3-Jan-13 2:06 
GeneralRe: Regarding Maven and Jenkins Pin
sivaKrishna joga3-Jan-13 2:13
membersivaKrishna joga3-Jan-13 2:13 
GeneralRe: Regarding Maven and Jenkins Pin
Richard MacCutchan3-Jan-13 2:58
mvpRichard MacCutchan3-Jan-13 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 18 Jan 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid