Solved

Using java to download and run files in a applet

Posted on 2007-11-22
2
234 Views
Last Modified: 2013-11-24
I am currently developing a project to match with an existing one and I'm attempting to create a web-based java applet that downloads a text file then opens it. I've attempted to do this already and failed.

The method I tried for downloading is (only a SMALL bit to allow better understandment) :
"URL url = new URL(address);
out = new BufferedOutputStream(
new FileOutputStream("C:\\temp\\" +localFileName));
conn = url.openConnection();
in = conn.getInputStream();"

I had a basic text for the applet using this:

"public void paint(Graphics g)
     {
      g.drawString("Please wait..",20,20);
      g.drawString("Retrieving file.",20,40);
}"

However, only the text bit showed. The downloading and running code simply didn't do its job. It passed compile and it works fine when I run the .class using batch, but the minute I jar it, it won't even run using a batch file nor applet. Basically, I want to know how to make a proper .jar applet that downloads and runs a file from a chosen URL (which will be in the same directory as the jar, on the same webserver).
0
Comment
Question by:HiTechFail
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Expert Comment

by:contactkarthi
ID: 20336223
0
 
LVL 2

Accepted Solution

by:
HiTechFail earned 0 total points
ID: 20336664
They help a little, but still does not work after implementing into an applet.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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
null output 3 59
Facing this issue for maven proxy setting 2 45
ArrayList Adding/settign data 3 38
JDBC performance 8 35
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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

751 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