hello everyone,
I am developing an application for my project...
My application works correctly when I run it on applet viewer...But when i try to run it with the help of html page ..the code does not run and gives an erron java.security.accessdenied exception....
Actually i have loaded an image in my applet ...when the applet calls the image then the error occurs....Could anyone suggest some ammendments...so that i could load my background image from web also...

import java.applet.*;
import java.awt.*;
import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;
import java.security.*;
class surds_frontpage extends Applet implements Runnable,ActionListener
{

Thread t=null;//a thread gives all the graphics as color changing in this case to be clearly visible
int call=1;
float count=0f;
Font f=new Font("SanSerrif",Font.BOLD,20);
Button stages=null;
Image img;
MediaTracker track;
Font f1=new Font("Jokerman",Font.LAYOUT_LEFT_TO_RIGHT,40);
Font f2=new Font("Jokerman",Font.LAYOUT_LEFT_TO_RIGHT,70);

public surds_frontpage()
{

this.setVisible(true);
//this.setBackground(Color.red);
this.setLayout(null);
this.setForeground(Color.blue);
this.setFont( f);

this.getImage(surds/139,"i");
stages=new Button("Stages");
stages.setBounds(500, 500, 80, 30);
add(stages);
stages.addActionListener(this);

img=Toolkit.getDefaultToolkit().getImage("ab.jpg");
track=new MediaTracker(this);
track.addImage(img, 0);

try
{
track.waitForID(0);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
this.setSize(800,590);

//add(p1);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==stages)
{

    this.setVisible(false);

    this.resize(0, 0);

    surds_rules rule=new surds_rules();

    rule.repaint();

}

}
public void start()
{
if(t==null)
{
t=new Thread(this);
t.start();
}

}
public void run()
{

while(count<8f)
{
    count=count+0.2f;
    repaint();

try
{
    Thread.sleep(1000);
}
catch(InterruptedException e)
{
    e.printStackTrace();
}
if(count==0.8f)
{
count=0f;
}
}

}
public void paint(Graphics g)
{

g.drawImage(img, 0,0,1400,1300,null);
Color c=Color.getHSBColor(count, 1, 1);
g.setFont(f1);
g.setColor(c);
g.drawString("Welcome To Surds Solving", 450, 100);

}
public void destroy()
{
t.stop();
}
}

You should put all the files needed for your applet into a jar file and use the class loader's getResource method to get to the file so it can bee read. Do a Search here for getResource for example code.

Thanks a lot sir.... I got a solution for my problem..actually the application loaded when i used the getCodeBase() method....Thanks a lot 4 your reply....

This question has already been answered. Start a new discussion instead.