Applet retreiving file list in Codebase

I want an applet to get the list and consequently open all the files in its code base. They are all images that i want to present in a tabbed window.
The application version of the code used the File.list( ) method. But i guess that is not usable from an applet due to security restrictions.

Thanks,
But how do you enable browsing ... also ... if i get the list somehow ... can it be used only for images, or can i open other text files also ..
If you enable browsing (showing file list for
browsing) on the virtual directory where the image
files are located, then you can download the file list
and use it to get the URL of every single image. Even
better would be to implement some functionality on the
server that simply gave you the list of URL's upon
request.

Similar Messages

  • Java applet security file.list()

    I am trying to read the directory structure from a signed applet. I
    have created the applet and provided it with the
    UniversalFileAccess. I am able to read a specific file, and see all
    the contents of the file. I am wanting to performa simple
    directory listing vie the following code.
    My browser is Communictor 4.76 on Win 2000.
    blah.. blah...
    if(browser.indexOf("netscape") >= 0){
    //Assert Netscape permissions
    try{
    // tried UniversalFileRead, UniversalFileAccess,
    UniversalPropertyWrite,
    PrivilegeManager.enablePrivilege("UniversalFileRead");
    System.out.println("Netscape now has UniversalFileRead
    privilege.");
    } catch (netscape.security.ForbiddenTargetException e1) {
    System.out.println("Permission to read file system denied by
    user.");
    e1.printStackTrace();
    } catch(Throwable e){
    System.out.println("Could not enable privilege." +
    e.getMessage());
    e.printStackTrace();
    try {
    File f = new File("c:\\temp\\");
    String [] fileList = a.list();
    } catch (Throwable e) {
    System.out.println("File List failed");
    e.printStackTrace();
    I keep getting a secuity exception that I do not have priveledes to
    perform this action.
    Can anyone help!!!!!!!! I am on a deadline, and this is working just
    fine with IE.
    Please reply directly to me, as this is the first time I've ever posted
    to this newsgroup. My email is [email protected]
    Thanks,
    James Kurfees

    This question has been asked many times in these forums.
    There is no way to prevent this from a determined reverse engineer.
    Search for java obfuscators, which can help a little bit.
    The only way to prevent code stealing is to run it on your own server,
    which means not to use applets, but servlets/JSP. I am sure this is
    not what you want to hear.

  • Reading All Files inside folder codeBase, Applet!

    I have an applet, placed in a Jar file.. everything is ok,,
    I have a resource folder outside the Jar, which has some files.
    how can I read what is inside the resource folder, which is located outisde the Jar, without having their addresses before hand!!
    in short, I would like the applet to open the resource folder, get an array of all files in the folder, and then reads them.
    I tried encapsulating the getCodeBase().toURI() with a File Object.
    But when I call the file.list() it throws an AccessControlException
    thank you.

    Here is a simple example of using ftp to obtain file list using Jakarta common net package.
    // ftp - related imports
    import org.apache.commons.net.ftp.FTPClient;
    import org.apache.commons.net.ftp.FTPReply;
    // main method
              FTPClient ftpClient = null;
              try {
                   ftpClient = new FTPClient();
                   ftpClient.connect("REMOTE_HOST", "remote port, use 21 in common case");
                   System.out.print(ftpClient.getReplyString());
                   int reply = ftpClient.getReplyCode();
                   if(!FTPReply.isPositiveCompletion(reply)) {
              ftpClient.disconnect();
              System.err.println("FTP server refused connection.");
              System.exit(1);
                   boolean isLoggedIn = ftpClient.login("your login", "your pass");
                   ftpClient.changeWorkingDirectory("/your remote dir/");
                   String[] fNames = ftpClient.listNames();
                   for (int i = 0; i < fNames.length; i++) {
                        System.out.println(fNames);
                   ftpClient.logout();
              } catch (IOException e) {
                   e.printStackTrace();
              } finally {
                   if(ftpClient.isConnected()) {
                        try {
                             ftpClient.disconnect();
                        } catch(IOException ioe) {
                             ioe.printStackTrace();
    System.exit(0);

  • How to load an applet jar file?

    Hello everyone,
    I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
    When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
    // Try to load additional jar files in background by loading a class from each jar file.
    Thread loadClass = new Thread() {
      public void run() {
        System.out.println("Loading classes...");
        try {
          // Tried loading classes this way, doesn't work.
          getClass().getClassLoader().loadClass("pkg1.Class1");
          getClass().getClassLoader().loadClass("pkg2.Class2");
          getClass().getClassLoader().loadClass("pkg3.Class4");
          getClass().getClassLoader().loadClass("pkg4.Class4");
          /* Loading classes this way doesn't work either.
          Class.forName("pkg1.Class1");
          Class.forName("pkg2.Class2");
          Class.forName("pkg3.Class3");
          Class.forName("pkg4.Class4");
        catch(ClassNotFoundException e) {
          // First attempt to load a class (pkg1.Class1) throws exception.
          System.out.println("Can't find class: " + e.getMessage());
    loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
    Loading classes...
    Loading: pkg1.Class1
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
    Can't find class: pkg1.Class1
    So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
    Any help/suggestions are appreciated.

    The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
    The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
    public void start() {
      // ...initialize gui...
      // Applet freezes and remains grey, also the java console freezes.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          System.out.println("Loading classes...");
          try {
            // When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
            Class.forName("pkg1.Class1");
         Class.forName("pkg2.Class2");
         Class.forName("pkg3.Class3");
         Class.forName("pkg4.Class4");
            System.out.println("...Done loading classes");
          catch(Exception e)     {
            System.out.println("Can't find class: " + e.getMessage());
    }

  • Question about Java Applet Jar file signing.

    These questions pertain to Java 6 Standard Edition 1.6.0_22-b04 and later.
    I have gone through the Oracle Java Tutorial for generate public and private key information
    to sign a jar file, and how to sign the jar itself, all at
    [http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html]
    , and seek some clarification on the following related questions:
    -In order to "escape" the java applet sandbox that exists around the client's
    copy of the applet running in their web browser, ie.
    (something forbidden by default), is verification of the signed applet enough, or is a policy file required
    to stipulate these details?
    -using the policytool policy file generator, what do I need to add under "Principals"
    (if anything) when dealing with a Java applet? Are Codebase and SignedBy simply author information?
    -If I choose to use a java.security.Permission subclass object set up in equivalent fashion within the Applet,
    which class within the Applet jar do I instantiate that object in? Does it need to be mentioned
    in the applet's jar Manifest.MF file?
    -Is the "keystore database" a java language service/process which runs in
    the Server's memory and is simply accessed and started by default
    by the client verifier program (appletview/web browser)?
    -The public key certificate file (*.cer) is put in the webserver directory holding
    the Applet jar file (ie. Apache Tomcat, for example).
    -Presumably, the web browser detects the signed jar
    and certificate file, and provides the browser pop up menu asking the user
    about a new, non recognised certificate (initially).
    Is this so?
    -With this being the case, can the applet now escape
    the sandbox, be it with or without the stipulated
    policy permissions?

    848439 wrote:
    -In order to "escape" the java applet sandbox that exists around the client's
    copy of the applet running in their web browser, ie.
    (something forbidden by default), is verification of the signed applet enough, or is a policy file required
    to stipulate these details?Just sign the applet, the policy file is not necessary.
    -Is the "keystore database" a java language service/process which runs in
    the Server's memory and is simply accessed and started by default
    by the client verifier program (appletview/web browser)?No.
    -The public key certificate file (*.cer) is put in the webserver directory holding
    the Applet jar file (ie. Apache Tomcat, for example).No. For a signed Jar, all the information is contained inside the Jar.
    -Presumably, the web browser detects the signed jar
    and certificate file, and provides the browser pop up menu asking the user
    about a new, non recognised certificate (initially).
    Is this so?No. It is the JVM that determines when to pop the confirmation dialog.
    -With this being the case, can the applet now escape
    the sandbox, ..Assuming the end-user OK's the trust prompt, yes.
    ..be it with or without the stipulated
    policy permissions?Huh?

  • Multiple repeat downloads of applet jar file

    We have an applet that is downloaded from a Weblogic server. The applet is packaged as a jar file. Some of the testers have been complaining that the applet is extremely slow to start up.
    The applet start-up involves three phases. In a first phase, it fetches data from the server. This phase seems to execute in pretty much constant time. During the second and third phases, it constructs a UI using Swing objects. The UI includes some JPEG files, which are extracted from the applet's own jar file.
    Testers report that the slow part of start-up is actually the UI setup. This should theoretically not be network-bound at all. But packet tracing reveals that during this phase, there's a large amount of network traffic going on. It turns out that there are multiple GET requests for the applet jar file being issued. Typically, 29 requests are issued in all; just for reference, the applet is required to extract 28 images from its jar file, so it looks as if the additional requests correspond to image requests.
    One further detail: this does not occur where there is a fast connection to the server. In these cases, the applet is downloaded once. It looks as if the problem only occurs on slower network connections, and the speculation here is that the applet jar is somehow being downloaded only partially, so that requests for images somehow trigger a re-request of the jar file.
    Has anyone seen anything similar and, more to the point, is there a fix or workaround?
    Technical details: Internet Explorer 5.5 or 6.0, JRE version 1.4.2_01 Java HotSpot(TM) Client VM (on the client), WebLogic 8.1 (on the server)
    Thanks in advance for any help.

    Ok.
    I have been trying hard and found the solution. One of the ablove posting says that it works under java 1.4.1 plug-in. That's infact absolutely true. It also says that how to run client using JRE 1.4.2 or higher. That can be solved two. This is definitely a bug with the 1.4.2 plug-in.
    Follow this procedure that will solve the mystry.
    ----------------------start ---------------------------------
    Problem
    Download of applet is very slow
    Why?
    This was happening because of the repeated download of the applet jars by the applet plug in controller. It is quite clear that the Java 1.4.2 plug in controller has a bug that causes the plug in to download same jar files multiple times irrespective of Jar cache in the client side (configurable from client side using the Java plug in control panel) is enabled or disabled. Therefore, we have moved from 1.4.2 plug in to 1.4.1 (controlled from our client (JSP) code) that works fine.
    What the client (applet client) should do?
    You must do the following in the client side in order to avoid the long download time for applet when running from a browser. We have also found that the browser actually do not matter in slow applet downloads. It is only the plug in that does control the applet download.
    Irrespective of what JVM you have already installed (or not yet installed) please do the following:
    1. Download the JRE 1.4.2 from http://java.sun.com/products/archive/index.html
    -At the time of its installation if it shows that the "JRE is already installed do you uninstall it?" Go ahead and uninstall the JRE 1.4.2. After the un-installation again install the JRE 1.4.2
    -If it does not have the JRE 1.4.2 already installed, then you will see any warning window and you will be able to install the 1.4.2 JRE successfully.
    2. Now, go to the same link and install JRE 1.4.1.
    -If this JRE already installed, uninstall first like the step 1 above. then reinstall it.
    3. Now, after successful installation of the JRE 1.4.1, open the Plug-In control panel.
    -You will find the list of control panel(s) in the Start->Control Panel window. Use the control panel that shows the version number 1.4.1. If no version number shown then use the one that do not show any version number at its end.
    4. Do the following on the Plug-In control panel.
    -Verify if this is the 1.4.1 plug in control panel? Go to the "About" tab to see if it shows 1.4.1.
    If it does not show the 1.4.1 (or 1.4.1_x) then plug in was not installed correctly. Reinstall the 1.4.1 JRE following the step in no-2
    -Go to "Basic" tab and select "Show console" radio button.
    -Go to "Advanced" tab and from the drop down select "JRE ...1.4.2" from the "Java Runtime Environment" drop down box.
    -Go to "Browser" tab and select all that in the "Settings" box applicable for browsers.
    -Go to "Cache" select "Enable Caching" if it is not selected currently. Select "Unlimited" from "Size" options.
    Now hit "Apply" button at the bottom and close the control panel using the 'X'.
    5. Restart your Windows machine.
    6. You are ready to run the applet from any of the browser (IE, NS, etc.)
    --------------------------end------------------------------

  • How does one change the font size for folders and/or file lists in the Bookmarks Library?

    How does one change the font size for folders and/or file lists in the '''Bookmarks''' Library?
    Since the upgrade to version 9.0.1 of Firefox, the Bookmarks feature changes are confusing me. They seem to be confusing themselves as well. The list of bookmarks has changed. The font size is so small that my aging eyes cannot read it without fogging the screen with my breath. Some folders are out of alphabetical order (where I know they were previously good), and some are missing altogether (folders to which I frequently add references).
    As for missing or deranged files or folders, was there something that I should have done or now need to do to recover those after the upgrade (or before)?
    With regard to font size,
    1. there is no “Edit Bookmarks” or like option to edit the list in this version
    2. the “zoom” option in the “view” list of functions is greyed out when in “Show All Bookmarks” window
    3. expanding the browser window has no effect on font size
    4. “Preferences” settings for font size has no effect in that window either, including advanced settings
    5. “Help” offers none that I can find.
    Can any of you Help?!?

    Maybe this extension helps:
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/

  • URLs in orphaned file list?

    when I check for orphaned files on my very old, very messy
    website I see urls like "/http:/java.sun.com",
    "mailto:[email protected]" and nothing happens when I choose
    "open file". I can delete them from the list but when I run the
    orphaned files check again they're all back! what's going on?
    I recognize most of these as files and links that were
    deleted long ago (them and the pages that linked to them). How is
    dreamweaver finding these links and what are they doing in the
    orphaned files list?

    > I recognize most of these as files and links that were
    deleted long ago
    Under the main dw menu->Site->Advanced->Rebuild Site
    Cache.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • Computer Contents in File List

    My file list now contains all of the items and files in my
    computer, including all materials on my back-up hard drive and the
    network. How do I delete this from the file list.

    That's normal- it belongs there. ignore it or use when it's
    handy.
    It's use is to find and copy files that are outside of the
    Local site folder
    while staying inside of dreamweaver.
    If it wasn't there- you'd have to go to the Desktop or My
    Computer, browse
    to the file, copy it, browse to the Local Site Folder, paste,
    then go back
    into dreamweaver.
    suggestion- go to the Help menu-->Using
    Dreamweaver-->the dreamweaver
    workspace or similar wording.
    > I am new to Dreamweaver 8 but there is s drop down menu
    under file. The drop
    > down is titled computer and when the drop down is open
    my options are
    > Macintosh
    > HD, PSP5000 (which is my back-up drive) and network.
    Separated by a line is
    > manage sites. Does this help?
    >

  • Unable to clear the recently open files list

    Currently, in order to clear the opened files list, the user has to go into the Windows registry.  This by itself can be bad if the user is not familiar with the registry; could mess up the registry if not very careful.  There appears to be no plug-in/addon for this option nor is there any user option to select to clear the list.  There is a setting in the options/permissions to limit the number of opened files to the list; the minimum number being one(1).  Cannot set this number to zero(0) unless maybe there is a registry fix for this.  I want to suggest that in the next release, or at least as soon as possible, to add to the Adobe Reader (by default) a user option to be able to clear this list with having to enter the registry.  Or, maybe create a plugin/addon to perform this action.  That's it.

    Hi Ineedtoknownow
    You can raise your feature request on below link : https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • How to use dynamic file as welcome-file-list in web.xml

    I have configured my web.xml file as this,
    <web-app>
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>login.jsf</welcome-file>
    </welcome-file-list>
    </web-app>
    and my login.xhtml file as this,
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:f="http://java.sun.com/jsf/core">
    <body>
    <f:view>
    <h:form>
    UserName:<h:inputText id="userName"
    value="#{bean.userName}" rendered="true"
    required="true"/>
    Password:<h:inputText id="password"
    value="#{bean.password}" rendered="true"
    required="true"/>
    <h:commandButton id="submit" value="Submit" action="#{bean.authenticate}" />
    </h:form>
    </f:view>
    </body>
    </html>
    but when i deploy this using tomcat and try to put url as this,
    http://localhost:8080/project
    Its not identifying welcome file from web.xml
    I am getting error like this,
    The requested resource (/project/) is not available.
    How to resolve this,
    Thanks,
    Vinutha

    This might help:
    http://forum.java.sun.com/thread.jspa?threadID=696586
    As well, you might have to change the servlet-mapping in your web.xml. The url-pattern, I think, needs to be .xhtml. Your login.jsf file in the welcome list will need to be renamed to login.xhtml.
    CowKing

  • After successful install, I am unable to use RoboHelp 7 because of constant refresh of file lists

    RoboHELP 7 installed on Windows XP
    Our enterprise support team installed RH7 on my new laptop via our corporate intranet.  I received an e-mail message reporting that the install failed so I contacted the support team, someone logged on to my machine by remote and did an uninstall of RH7.  Then, the install was done again and the same failure message was received.  Then, RH was uninstalled and the install was attempted for the third time.  Again, I received the failure message.  I had noticed that after each install the icons appeared on my desktop.  So, after this third install, I went ahead and clicked the RH7 HTML icon and the program seemed to start properly.  I have a key number from our enterprise team and I entered the key number to complete the registration.  The UI appeared and I selected my recent project.  RH built the file lists that I expected to see in the left panes of the interface but the file lists kept "twitching" and the cursor kept changing to the hourglass and back.  This happened about once every two or three seconds and I could not move my cursor fast enough to select a file.
    One of my co-workers suggested that I uninstall RH7 myself, check the registry and erase any robohelp entries.  I know this is risky but I am confident I can do it.  However, I would like to hear from any RH experts about how to solve this "twitching" problem, if there are other possible solutions.  Thanks.

    My gut feel is that if your organisation is large enough to have an Enterprise license, IT would not take too kindly to you uninstalling the product yourself and editing the registry. That's your issue though.
    If they are happy, then you could try www.revouninstaller.com with which a number of people have reported good results if you use the stronger options to clear the registry. Again at your risk and responsibility.
    You might also like to look at http://www.adobe.com/devnet/robohelp/articles/before_install.html. It includes the script IT should be using. Maybe that should be checked as well.
    The other approach is to get them to do a direct install. Worth trying given the issues you are having.
    See www.grainge.org for RoboHelp and Authoring tips

  • 'Open Recent' files list

    The 'Open Recent' files list is too short.
    Is there a way to make it longer, e.g. for 25 or 50 files?
    Thanks!

    I'm not sure that it's a good idea but it's your wish so here is the soluce:
    set nbRecents to 30
    do shell script "defaults write com.apple.iWork.Pages NSRecentDocumentsLimit " & nbRecents
    If you want the same behavior in Numbers, use:
    set nbRecents to 30
    do shell script "defaults write com.apple.iWork.Numbers NSRecentDocumentsLimit " & nbRecents
    In fact we may use that for every application with a Recent Items menu.
    I got it in a thread dedicated to the behavior of Script Editor.
    Yvan KOENIG (from FRANCE dimanche 10 mai 2009 19:16:11)

  • How to delete latest opened file in the recent opened files list?

    Does any one know if there is any api to modify the recent opened files list under the meun File->Open Recent File?

    There is not.

  • Retreiving files over http or ftp.

    I was wondering what program I should use to retreive files over http or ftp. Previously I had used wget per my hosting provider's recommendation. It worked when I was ssh logged in to his server (via Mac Terminal). However, when I try using wget on my local Mac it says "command not found".

    Thanks. So if I specify a file name (-o /path/to/file), does the incoming file get renamed to that (and put in that location) or does this specify the directory (-o /path/to/directory) that the incoming file will go to? I wasn't quite clear on that.
    Also, I keep hearing about stdout. What is it exactly? I assumed it was just the Terminal window itself, the alternative being things like | more or | nano or something like that... Or am I totally up the wrong tree?

Maybe you are looking for