applet read server prop
Hello
I cannot figure out how to get an applet, to read a simple properties file that is at the same directory level as the html/jsp file that loads it. I have tried below and it fails with fnf, even though if I put in the full url name in the browser it opens the fil directly. What dont I understand sufficiently to read the file and return a properties object? tia
public Properties getProps(String fname){
Properties props =new Properties();
InputStream propIn =null;
String line;
URL url =null;
try{
url =new URL(getCodeBase(), fname);
}catch (MalformedURLException ex){
System.out.println("MalformedURLException");
ex.printStackTrace();
}
try{
propIn =new FileInputStream(url.toString());
}catch (FileNotFoundException ex1){
System.out.print("FileNotFoundException");
ex1.printStackTrace();
}
try{
props.load(propIn);
}catch (IOException ex2){
System.out.println("IOException on props.load()");
ex2.printStackTrace();
}
return props;
}

