Results 1 to 4 of 4
  1. #1
    gkirca is offline Member
    Join Date
    Dec 2009
    Rep Power

    Thumbs down Filechecker in html via applet

    Hi all,

    nobody out there with an idea on this?
    I'm trying to implement a very little tool into my html code: a filechecker!
    It's not possible to use javascript for this, if you want to support other browsers than IE (ActiveX!).
    The html file I provide is a list of documents with an href set to the doc.
    The html file should be accessed via web but locally (e.g. CD or USB stick) as well (thus should work without XMLHttprequest).
    That's the intention!
    Now my code, how I tried to solve the problem:
    HTML code goes here >>>
    <script type="text/javascript">
    function fileChecker (fileName) {
    var Test = document.applets["fileExist"].fileChecker(fileName);
    if (Test == "true") {
    else {
    document.write("does not exists");
    <applet code="FileChecker.class" name="fileExist"></applet>
    <p>Document titled 'Something' <a href="javascript:fileChecker("./directory/")"</a>
    <<< HTML code ends here >>>

    Java code goes here >>>
    import java.applet.Applet;

    public class FileChecker extends Applet {
    // serial ID has no effect
    // private static final long serialVersionUID = 1L;

    public boolean fileChecker(String fileName) {
    boolean retcode = false;
    File fileToCheck = new File(fileName);
    System.out.println("File to check: " + fileName);
    retcode = fileToCheck.exists();
    return retcode;
    <<< Java code ends here

    The result is ... not as expected. I checked the java console (level 5), no errors nor any exceptions! But I even get no result in my html page!

    Anybody has an idea?
    Any hint very appreciated and thanks in advance ...
    Last edited by gkirca; 12-22-2009 at 10:37 AM. Reason: Question

  2. #2
    gkirca is offline Member
    Join Date
    Dec 2009
    Rep Power


    Hi community,
    nobody with an idea?
    Thanks in advance

  3. #3
    FON is offline Senior Member
    Join Date
    Dec 2009
    Belgrade, Serbia
    Rep Power



    You want to write code and send it over net to someones PC
    that can play around with his file system ?

    You can't do that.
    It is security issue!

    It's up to the user to check it.

    You will never be able to have direct interaction with the user's filesystem
    using applets in this way (security issues can be changed on clients JVM but
    dont want to mess with that)

    So what CAN you do?

    You wait for user to choose file from its filesystem.

    When he does that, and BEFORE he submit form,
    your AJAX function listens to this event all time, and when it happens
    function send info about it to your server behind scenes.

    find any ajax basic example for this
    and i hope it will help you

    regards :)

  4. #4
    gkirca is offline Member
    Join Date
    Dec 2009
    Rep Power



    Sorry for the late reply, I was a little busy in the last time.
    Thanks for your response. I know of the behaviour and the security restrictions, but I just want to find out, if it is possible to find a way to get around this.
    Meanwhile several colleagues told me the same. If I find a way (which I think will not happen), I'll update this thread.

    Thanks, merry christmas and a happy new year to all, who are reading this :-)

Similar Threads

  1. Two Form Applet in html
    By barusk in forum Java Applets
    Replies: 0
    Last Post: 03-16-2009, 05:36 PM
  2. Embedding Applet into HTML?
    By Unome in forum Java Applets
    Replies: 1
    Last Post: 02-21-2009, 03:40 AM
  3. Java Applet HTML
    By ownlol in forum Java Applets
    Replies: 4
    Last Post: 07-21-2008, 02:59 AM
  4. Chat Applet in HTML
    By Flynazn in forum Java Applets
    Replies: 3
    Last Post: 05-27-2008, 09:26 AM
  5. Create a Applet in the page HTML
    By Daniel in forum Java Applets
    Replies: 2
    Last Post: 07-04-2007, 07:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts