Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
hi guys,
i am new to java, i am facing some problem when searching a file in local system, my code is
Java Code:
import java.io.*;
import javax.swing.*;
import java.applet.*;
import java.net.*;
public class SignedApplets extends Applet{
/**
*
*/
private static final long serialVersionUID = 1L;
public void init(){
new WriteText();
}
public class WriteText {
WriteText(){
try {
String str = "D:\\Projects\\Java\\Applets\\Experiment\\WriteToAFile\\aff-masters.zip";
File f = new File(str);
if(f.exists()){
JOptionPane.showMessageDialog(null,"File Exists!");
}
else{
JOptionPane.showMessageDialog(null,"File not there!");
String link = "http://www.goldcoastwebdesigns.com/dl/aff-masters.zip";
try
{
AppletContext a = getAppletContext();
URL url = new URL(link);
a.showDocument(url,"_blank");
}
catch (MalformedURLException e){
System.out.println(e.getMessage());
}
}
}
catch(Exception x){
x.printStackTrace();
}
}
}
}
html
Java Code:
7
and policy
Java Code:
grant{
permission java.security.AllPermission;
};
it is working fine when searchable file and applet(related things) are in same directory.
suppose i wanted to search entire local drive(D) for a file. what i have to do... please help me in this scenario.
-------
Thanks and Regards,
Srihari(:~