File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes file dialog box does not appear if jar included via applet tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "file dialog box does not appear if jar included via applet tag" Watch "file dialog box does not appear if jar included via applet tag" New topic
Author

file dialog box does not appear if jar included via applet tag

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
If I do, in netbeans, left click on applet --> run file, form pops up, click on button brings up file dialog.



generated jar file included via applet on web page, form pops up, but nothing happens on button click !?

Note, have allso button which pops out message box, and that works fine in both cases.


All on same OS.

EDIT: wrapped whole thing into try catch --> no exception.
EDIT: The upper goes for FF.
in IE I get: access denied (java.util.PropertyPermission user.dir read)

How to fix that ?


Searchable nature photo gallery: http://agrozoo.net/jsp/Galery.jsp?l2=en
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
I guess it has to do something with this (picked from some other forum)

as I have,




Your .java.policy file in your home directory would have an entry looking something like this:-

grant codeBase "file:///Users/ben/path-to-project/build/Debug/project-name.jar" {
permission java.security.AllPermission;
};



So, I don't expect that, that would to be something that all end users would have to do ?

At the same time I can without prob write to my HD thrue applet. Realy strange.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

If you want to access files on the client computer via your applet, you will have to sign it. (Yes, theoretically you can put a java policy in the right place on the client but that isn't a very practical thing to do and almost nobody in real life ever does it.) However you'll find that in an IDE or applet viewer, that rule doesn't apply. It only applies in real life, namely in a browser.

If you are writing an applet that must be because you plan to have people download the applet from your web site and run it in their browsers. In which case you need to live within the applet security rules.

If that wasn't your plan then stop writing an applet and just write an ordinary application. (And if you have a Java book which teaches you about applets near the beginning then throw it away and get a newer one.)
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
so I went to create certificate (following instructions here:webpage)



this goes OK, asks me if I trust it, , I confirm and get:



What that means ?
Cacerts file is surely there.
I had 'cacerts.' in keystore file path (have no idea what dot stands for), in one of previous trials, same thing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file dialog box does not appear if jar included via applet tag
 
Similar Threads
Problem with "New Folder" icon
JfileChooser selecting existing file.......?
JFileChooser
JFileChooser in an applet
JTextArea as a pop up