I m working with applets.but i got struck.I want to explorer directorys and file in Brouser (just like as we open my computer by right click explorer). but i m finding problem in that which java class and method i should use.As when we work without applet it's is simple to get directory and file by using class File.class, but we can not use this class in applet.
Plz tell me what alternative I can use here.

Thias sort of thing should not even be attempted by an applet (in most cases). This sort of thing expressly forbidden in most security policies. You may use a signed applet (Google that) and it will allow you some access. To get "full" access, the user using the applet would have to change his security settings (in the JVM not the browser, i.e. he won't find a "friendly" GUI element to do it with).

Comments
this is really helpfull.

thanks masijade, now I start working on signed applet,Mine wile I got one site which which has some demo, and I want exactly same as that demo.I m sanding link of that so plz reffer that also. link is, http://www.jscape.com/httpfileuploadapplet/
So plz suggest me that how can do that.

Thias sort of thing should not even be attempted by an applet (in most cases). This sort of thing expressly forbidden in most security policies. You may use a signed applet (Google that) and it will allow you some access. To get "full" access, the user using the applet would have to change his security settings (in the JVM not the browser, i.e. he won't find a "friendly" GUI element to do it with).

Hello masijade I work with signed applet but I m gating problem in stape 4 sing the jar file.
I have wirte small code for testing.that coad get compile but on runing in brouser it is showing empty winwod .I m samding my coad plz tell me what a problem with it.

import java.applet.*;
import java.awt.*;
import java.io.File;
/*<applet code="AppletDemo" width=300 height=50>
 *</applet>
 */

public class AppletDemo extends Applet implements Runnable {
    
    String msg = "This is Threshold Software Solution.";
    String msg1[] =null;
    Thread t = null;
    int n;
    
    String dirname = "/ajay";
    File f1 = new  File(dirname);
        
    int state;
    boolean stopFlag;
    
    public void init () {
        setBackground(Color.cyan);
        setForeground(Color.red);
    }

    public void start (){
        if (f1.isDirectory()){
            msg = "Diretory of "+ dirname;
            String s[] = f1.list();
            
            for(int i=0; i<s.length;i++){
                File f = new File(dirname+"/"+s[i]);
                if (f.isDirectory()){
                    msg1[1] = s[i]+" is dir a directory";
                    //System.out.println(s[i]+" is dir a directory ");
                }else{
                    msg1[1] = s[i]+" is file";
                    //System.out.println(s[i]+" is file");
                }
            }
        }else{
            msg = dirname+" id not a directory";
            //System.out.println(dirname+" id not a directory");
        }
        t = new Thread(this);
        stopFlag = false;
        t.start();
    }
    
    public void run (){
        char ch;
        
        for(;;){
            try{
                repaint();
                Thread.sleep(250);
                ch=msg.charAt(0);
                msg = msg.substring(1, msg.length());
                msg +=ch;
                if (stopFlag)
                    break;
            }
            catch (InterruptedException e){
                
            }
            
        }
    }
    
    public void stop(){
        stopFlag = true;
        t = null;
    }
    
    public void paint (Graphics g){
        g.drawString(msg,50, 30);
        n = 30;
        for(int i=0; i<msg1.length;i++){
            n+=10;
            g.drawString(msg1[i],50, n); 
        } 
    }
}

Thias sort of thing should not even be attempted by an applet (in most cases). This sort of thing expressly forbidden in most security policies. You may use a signed applet (Google that) and it will allow you some access. To get "full" access, the user using the applet would have to change his security settings (in the JVM not the browser, i.e. he won't find a "friendly" GUI element to do it with).

This article has been dead for over six months. Start a new discussion instead.