Forums Register Login

linux file access

+Pie Number of slices to send: Send
I am creating a simple applet to enter info in and write it to a file, on a linux machine. I can compile the applet fine and when I run it and try to write to the file I get a:
access denied (java.io.FilePermission temp.dat write)
but the directory where I am trying to write has full write permissions set and I tried doing it as root and I still get this message. If anyone has any thoughts, I would really like to hear them!
+Pie Number of slices to send: Send
Hmm, could you post your applet's code ?
It's hard to tell what is wrong without having any clues

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )

+Pie Number of slices to send: Send
import java.awt.Graphics;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class IsReq extends Applet implements ActionListener {
private TextField text1, text2, text3;
private Button submit, clear;
private Label label1, label2, label3, label4;
private CheckboxGroup group;
private Checkbox check1, check2;
private DataOutputStream output;
public void init()
{
label1 = new Label( "Your name: " );
add( label1 );

text1 = new TextField( 25 );
add( text1 );
label2 = new Label( "Department:" );
add( label2 );

text2 = new TextField( 25 );
add( text2 );
label3 = new Label( "Date Required:" );
add( label3 );
text3 = new TextField( 8 );
add( text3 );
group = new CheckboxGroup();
label4 = new Label( "Problem Type:" );
add( label4 );
check1 = new Checkbox( "Software", group, false );
add( check1 );
check2 = new Checkbox( "Hardware", group, false );
add( check2 );
submit = new Button( "Submit" );
submit.addActionListener( this );
add( submit );
clear = new Button( "Clear" );
clear.addActionListener( this );
add( clear );
}


public void actionPerformed( ActionEvent e )
{
if ( e.getSource() == submit )
{
showStatus( "Submitting information..." );
try
{
output = new DataOutputStream(
new FileOutputStream( "temp.dat" ) );
output.writeUTF( "Name: " + text1.getText() );
output.close();
showStatus( "Information submitted!" );
}
catch( IOException a )
{
showStatus( a.toString() );
}
}
if ( e.getSource() == clear )
{
text1.setText( "" );
text2.setText( "" );
text3.setText( "" );
check1.setState( false );
check2.setState( false );
}
}
}


Let me know if you need anything else.
+Pie Number of slices to send: Send
Oh, I see.
Actually, you have to grant corresponding permissions to applet for it to be able to work with files.

------------------
With best of best regards, Pawel S. Veselov ( aka Black Angel )

Yup, yup, yup. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1279 times.
Similar Threads
Writing a file from an Applet
jnlp and property files
read and write files using applet
Applets form in webpage
applets reading from text file on client machine?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:37:01.