Results 1 to 10 of 10
  1. #1
    drez is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Red face DnD within applet no longer working on Java 6 update 20

    Hi All. I am new here.

    My Drag and Drop is no longer working after Java 6 update 10 to update 20.

    The applet I worote shows
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)

    I know about applet limitations but why id worked fine with Java 6 update 10?

    The same when I lounch Java sun demo application from Demo - BasicDnD (The Java™ Tutorials > Creating a GUI With JFC/Swing > Drag and Drop and Data Transfer)

    I don't want to sign applet and I cannot ask every user on the interent to modify "trust" files or whatever.

    Can someone please show me how to DnD within same applet (for example JTree to JText area.

    The problamatic code is
    public void drop(DropTargetDropEvent dtde) {

    try {
    Transferable t = dtde.getTransferable();

    if (dtde.isDataFlavorSupported(DataFlavor.stringFlavo r)) {
    dtde.acceptDrop(dtde.getDropAction());
    writeStringToTextAreaMethod(t.getTransferData(Data Flavor.stringFlavor).toString());
    dtde.dropComplete(true);
    } else dtde.rejectDrop();
    } catch (IOException ioe) {
    } catch (UnsupportedFlavorException usf) {
    } catch(AccessControlException pe){}

    }

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,335
    Rep Power
    25

    Default

    Sounds like Sun has changed something again.
    I have a simiilar problem with some Applets I was using on my computer that read files locally. I had used the .java.policy file to give the applets permission. About version 6u4(??) the applets got Permission exceptions in some browsers: FF and IE. Never did figure it out. I backed up/changed the javaplugin for an older browser to version 5 and am able to use my applets with that browser.

    Just noticed
    java.awt.AWTPermission accessClipboard
    It would seem that for security reasons an applet should NOT be able to read a user's clipboard.
    Last edited by Norm; 05-19-2010 at 10:23 PM. Reason: Add msg re clipboard

  3. #3
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    emm...

    I think there can be some reasons

    1) it is not JRE but its cert store has been rewritten :) You just add missing certs to your Java control Security -> Certificates.
    2) Or maybe your app cert validity is simply up to date. Please watch its "Details" as from...to... and tell us the result
    3) Or maybe the applet was modified and its signature is no more active :(

    Please check out those three steps and tell us the result
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  4. #4
    drez is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks for your replies

    My applet is not signed (never was) and the DnD solution worked fine until java6u10.

    If you have java6u20 then please look at Java Sun DnD examples. Drag and Drop and Data Transfer: Examples (The Java™ Tutorials > Creating a GUI with JFC/Swing > Drag and Drop and Data Transfer)
    These examples are not working (when you click Lounch) either on Java 6u20.

    I believe that Sun messed up something ;)

    I found a work around on this since I am "Draging and Dropping" within same applet. On the target drop Pannel, i am simply checking what is selected on the source list. So this is not atempting to read or write the clipboard.

    public void drop(DropTargetDropEvent dtde) {
    //tree.getLastSelectedPathComponent()
    }

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,335
    Rep Power
    25

    Default

    These examples are not working
    I just went to the site, clicked on Launch, checked "Use DnD" in lower left of panel and had the DnD work in the text fields and text areas on the right

  6. #6
    drez is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi Norm

    You have probably Java version 6 update 10 or older. It is not working with at java 6 u 20 for example.
    I have connsole open and I can see exception when I run the DnD examples.

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,335
    Rep Power
    25

    Default

    Here's my Java console when I Launch:
    Java Web Start 1.6.0_20
    Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\Owner
    ----------------------------------------------------
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    0-5: set trace level to <n>
    ----------------------------------------------------
    Here's the open permissions from my .java.policy file. Everything else has a codebase
    grant {
    permission java.lang.RuntimePermission "modifyThread";
    permission java.lang.RuntimePermission "loadLibrary.HelloNative";
    permission java.util.PropertyPermission "*", "read";
    permission java.lang.RuntimePermission "modifyThreadGroup";
    };
    Last edited by Norm; 05-20-2010 at 06:48 PM.

  8. #8
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    Sorry but this exception as

    java.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)
    says that your applet should be signed to access local clipboard

    I repeat either its signature is corrupted or you should resign it etc

    Actually there are two clipboard types... OS clipboard and proc clipboard ... The OS cb returns list of files java.io.File so any applet which contains that kind of clipboard should be signed... It is all depends the objects you want to paste :) The problem may occure if you trying to paste a local file from OS folder etc
    I think it is your case ;)
    Last edited by Webuser; 05-20-2010 at 09:04 PM.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  9. #9
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    emm...
    concerning the JRE update
    perhaps the JRE update could change the number of DnD libs and their relations so to make your applet work don't make it use JRE libs but just add all required libs right to your applet jar and sign it... So make your applet call the required libs not from JRE but from its jar... You know I mean?
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  10. #10
    drez is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks to all for your replies.

    I use to have JDK 6 isntalled on my PC (don' remember update version) and then instlled JRE 6. Maybe the problem is seen only on my two testing PCs where both of them had JDK installed.

    Lounching Sun's BasicDnD shows exceptions on the console and a dialog showing "null" dropped between demo components.

    There are customers that complained about our "apache ssl" certicicate. Signing applet will result in another extra warning message "This signiture is not verified" to the customer.

    So I found a solution as I have described on my previous post.

Similar Threads

  1. Update statement not working.
    By OMFGITSROHIT in forum JDBC
    Replies: 5
    Last Post: 04-08-2010, 01:03 PM
  2. Why does refresh not update applet?
    By Krooger in forum Java Applets
    Replies: 1
    Last Post: 12-26-2009, 09:00 PM
  3. Applet not working
    By jyothi.priyanka in forum New To Java
    Replies: 5
    Last Post: 04-16-2009, 08:18 AM
  4. Scrolling Applet Pictures Disappeared After Update.
    By MrPitBull in forum New To Java
    Replies: 10
    Last Post: 04-05-2009, 12:21 AM
  5. ant no longer working
    By varun077 in forum Eclipse
    Replies: 1
    Last Post: 07-25-2008, 09:57 AM

Posting Permissions

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