Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

linux file access

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )

 
Roger Dickey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 )

 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic