Hii to all
m linux user... Developing my project in Eclipse IDE. and the project structure folder
is Merchant.com(my project name)-->WebContent-->pg(folder)-->index.html(file). I m run
this project on tomcat server so that the folder structure is
mycomputer-->usr-->shear-->Apachetomcat-->webapps-->MyProject(created manually by
me)-->Merchant.com
my code is
public class Url {
/**
* @param args
*/
public static void main(String[] args) {
try {
//
// Creating a url object by specifing each parameter separately, including
// the protocol, hostname, port number, and the page name
//
URL url = new URL("http", "www.Merchant.com" , 80, "/pg/index.html");
//URL url = new URL("http://Merchant.com/pg/index.html");
// We can also specify the address in a single line.
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
reader.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
I m getting 404 error when i run this as a java application.
so my question is where do i put index.html? AM i missing something?
[Updated on: Thu, 28 November 2013 08:29] by Moderator