-
Reading Files with RandomAccessFile
Dear all
I uploaded MyClass.class, TEST.HTM and TEST.TXT to Tripod. Everytime I run
TEST.HTM, it always says "cannot access file TEST.TXT"
If I add full URL "http://members.tripod.com/aaaaa/TEST.TXT" in the RandomAccessFile(),
it says "bad path".
I need to read files that are uploaded to my space in Tripod.
Please help.
Thanks,
Ivan
PS:
It works fine if it's on my local drive.
/* MyClass.java */
import java.awt.*;
import java.lang.*;
import java.applet.*;
import java.io.*;
public class MyClass extends Applet {
public void init() {
ReadTest();
}
public void paint(Graphics g){
System.out.println("Paint");
g.drawString(text, 15, 25);
}
public void ReadTest() {
String s;
try {
RandomAccessFile raf = new RandomAccessFile("TEST.TXT","r");
while (true) {
s=raf.readLine();
if (s==null) {
break;
}
System.out.println(s);
}
}
catch (IOException e) {
System.out.println("IOERR");
}
}
}
/* TEST.HTM */
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "MyClass.class"
width = "630"
height = "480"
>
</APPLET>
</CENTER>
</BODY>
</HTM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks