Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Applet and application

Posted on 2004-04-05
6
Medium Priority
?
166 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 300 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 300 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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:
Suggested Courses

916 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