aspose file tools*
The moose likes Java in General and the fly likes linux file access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "linux file access" Watch "linux file access" New topic
Author

linux file access

Roger Dickey
Greenhorn

Joined: Jun 12, 1999
Posts: 2
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!
Pawel Veselov
Ranch Hand

Joined: Jan 14, 1999
Posts: 165
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 )


With best of best regards, Pawel S. Veselov ( aka Black Angel )
Roger Dickey
Greenhorn

Joined: Jun 12, 1999
Posts: 2
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.
Pawel Veselov
Ranch Hand

Joined: Jan 14, 1999
Posts: 165
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 )

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: linux file access