|
-
applet works in viewer but not browser.
I have an applet that displays files that are resident in a certain network
directory. I compile and run the script in JPad it it displays the files
fine. When I copy the class file to my intranet directory and run the applet
in the web browser, it doesn't show the files in the directory. The script
is below. If I'm going about this all wrong, please let me know - I'm a
beginner.
Thanks in advance..
---------------------------------------------
import java.io.*;
import java.awt.*;
public class jobPosting extends java.applet.Applet
{
String direct = "\\\\hostname\\path\\";
int ht = 50;
public void init()
{
resize(300,300);
setBackground(Color.green);
}
public void paint(Graphics g)
{ g.drawString("Test Message", 100, 125);
getFileList();
String[] direct;
File f = new File(System.getProperty("user.dir"));
direct = f.list();
for(int i=0; i< direct.length; i++)
{
g.drawString(direct[i], 50, ht);
ht = ht + 20;
}
}//end paint
public void getFileList()
{
//**** This shows files inthe current directory. ****
File dir = new File(System.getProperty("user.dir"));
String user_dir = System.getProperty("user.dir");
//**** This shows files in the directory as set above. ****
System.setProperty ("user.dir", direct);
user_dir = System.getProperty ("user.dir");
//System.out.println(direct);
}//end getFileList
}//end applet
----------------------------------------------
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