Problems starting applet in browser

Discussion in 'Java' started by MiranL@gmail.com, May 5, 2006.

  1. Guest

    Hello!

    My code:
    InputStream in = null;
    URL url = new URL("http://my.url:80/myfile");
    URLConnection connection = url.openConnection();
    in = connection.getInputStream();

    ObjectInputStream ois = new ObjectInputStream(in);
    vFile = (Vector) ois.readObject(); // error



    When i run this code in appletviewer i get no errors, but in browser in
    get this message: access denied (Java.lang.RuntimePermission
    accessClassInPackage.sun.swing)

    In there any way to solve this problem without dig. signing the applet?
    Or perhaps to use some alternative to ois.readObject()...
     
    , May 5, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hello!
    >
    > My code:
    > InputStream in = null;
    > URL url = new URL("http://my.url:80/myfile");
    > URLConnection connection = url.openConnection();
    > in = connection.getInputStream();
    >
    > ObjectInputStream ois = new ObjectInputStream(in);
    > vFile = (Vector) ois.readObject(); // error
    >
    >
    >
    > When i run this code in appletviewer i get no errors, but in browser in
    > get this message: access denied (Java.lang.RuntimePermission
    > accessClassInPackage.sun.swing)
    >
    > In there any way to solve this problem without dig. signing the applet?


    It is possible without signing if your applet is started from the same
    server. If the applet is started from somewhere else, it will not work.
    If you use getCodeBase() instead of a hardcoded path, then you ensure that
    the server is exactly the same.

    Niels Dybdahl
     
    Niels Dybdahl, May 5, 2006
    #2
    1. Advertising

  3. Guest

    The problem is not in the connection between server and client but in
    this line:
    (Vector) ois.readObject();
     
    , May 5, 2006
    #3
  4. Oliver Wong Guest

    <> wrote in message
    news:...
    > The problem is not in the connection between server and client but in
    > this line:
    > (Vector) ois.readObject();
    >


    Regardless of where the exception is thrown, one of the restrictions for
    unsigned applets is that you cannot connect to any server except the one
    from which the applet is downloaded from. So when you're running this applet
    within your browser, is the applet being downloaded from http://my.url:80/ ?

    - Oliver
     
    Oliver Wong, May 5, 2006
    #4
  5. Andrew T. Guest

    wrote:
    ....
    > URL url = new URL("http://my.url:80/myfile");
    > URLConnection connection = url.openConnection();

    ....
    > When i run this code in appletviewer i get no errors, but in browser in
    > get this message: access denied (Java.lang.RuntimePermission
    > accessClassInPackage.sun.swing)


    As you should.

    > In there any way to solve this problem without dig. signing the applet?


    If you find one please let us know, so we can get Sun
    to issue a patch for it.

    Andrew T.
     
    Andrew T., May 6, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allen Flick

    Starting new Browser

    Allen Flick, Nov 13, 2003, in forum: HTML
    Replies:
    1
    Views:
    381
    Sid Ismail
    Nov 13, 2003
  2. Thomas Hawtin

    HTA starting continual applet

    Thomas Hawtin, Sep 24, 2006, in forum: Java
    Replies:
    1
    Views:
    629
    wilfried.pz
    Sep 24, 2006
  3. jeffbruce
    Replies:
    1
    Views:
    2,275
    travishein
    Aug 22, 2008
  4. Rick
    Replies:
    2
    Views:
    126
  5. David
    Replies:
    2
    Views:
    121
Loading...

Share This Page