Solved

Applet and application

Posted on 2004-04-05
6
152 Views
Last Modified: 2013-11-23
hi
I want to take file from hard disk through browse option using applet and the mentioned file should be read using Fileinput stream and copied to another file using File outputstream.how it can be done?
TIA
0
Comment
Question by:kousis
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
warturtle earned 75 total points
ID: 10759224
Hi,

Applets are not the best way to write to files, because they have security restrictions on a system. The Java Virtual Machine(JVM) has got a 'sandbox' model for Applets, they can't access any system resources, like writing files, etc.

Better way to do this task is to use Java Swing in a Java Application. Use the Java Swing Tutorial on Sun's website at http://java.sun.com

Regards,

Warturtle
0
 

Author Comment

by:kousis
ID: 10759531
I just wanted to get the file name through applet. I wanted my program to be user friendly.
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 75 total points
ID: 10763025
You can have a user-friendly interface through Swing/ AWT as well. But if you're not willing to do it by anything other than an Applet, then your Applet needs to be signed in order to access files, etc, otherwise I guess that it will throw a SecurityException.

Have a look at: http://www.mindprod.com/jgloss/signedapplets.html

http://personal.vsnl.com/sureshms/javasign1.html (courtesy objects)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10958056
Please proceed with that recommendation.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
nextBoolean(double p) for Random class 3 41
use lov values 2 63
runtime exception 2 42
Facing this issue for maven proxy setting 2 20
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question