Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

security problem

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.security.AccessControlException: access denied (java.io.FilePermission c:\one.txt read)

this massage comes when i try to run my applet into my under constracting project i am tring to load file to my server,

by the way applet viewer can run this applet and it work, policy tool i have put permission for this appelt but i do not know if it work or not.

thanks

if you need my applet to test it here is it.
to run it type location of your file.

// TestApplet.java
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import javax.swing.border.*;

public class TestApplet extends JApplet implements ActionListener {

private JPanel pane = null;
private JScrollPane scrolling = null;
private JTextPane fileBox = null;
private JTextField tfFilename = null;
private JButton butLoad = null;
private final String LOAD = "load";

public void init() {
try {
jbInit();
} catch(Exception e) {
e.printStackTrace();
}
}


// method which will read data from file, and return it in
// String

public String readFile(String fn) {
String thisLine, ret = "";
try {
FileInputStream fin = new FileInputStream(fn);
BufferedReader myInput = new BufferedReader
(new InputStreamReader(fin));
while ((thisLine = myInput.readLine()) != null) {
ret += thisLine + "\n";
}
} catch (Exception e) {
ret = e + "Cannot load, exception!";
}
return ret;
}

private void jbInit() throws Exception {
pane = new JPanel();
pane.setBounds(new Rectangle(0, 0, 500, 325));
pane.setLayout(null);
pane.setBorder(BorderFactory.createEtchedBorder(
EtchedBorder.LOWERED));
pane.setBackground(new Color(221, 194, 219));

fileBox = new JTextPane();
fileBox.setText("");
fileBox.setEditable(false);
scrolling = new JScrollPane(fileBox);
scrolling.setBounds(new Rectangle(16, 65, 295, 225));

tfFilename = new JTextField();
tfFilename.setText("");
tfFilename.setBounds(new Rectangle(16, 23, 206, 29));

butLoad = new JButton();
butLoad.setBounds(new Rectangle(231, 23, 80, 30));
butLoad.setText("Load");
butLoad.setActionCommand(LOAD);
butLoad.addActionListener(this);

pane.add(scrolling);
pane.add(tfFilename);
pane.add(butLoad);

setContentPane(pane);
}

public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(LOAD)) {
fileBox.setText(readFile(tfFilename.getText()));
}
}
}
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More interesting than the applet code would be the policy file you're using. Here is some more information on that subject.
[ October 19, 2006: Message edited by: Ulf Dittmer ]
 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
answer for this is in this site
you can made your applete to access your resource

http://personal.vsnl.com/sureshms/javasign1.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic