aspose file tools*
The moose likes Applets and the fly likes Applet doesn't work in browser. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet doesn Watch "Applet doesn New topic
Author

Applet doesn't work in browser.

Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
I have written an Upload applet using commons.fileUpload library.
When I test the applet in Netbeans applet viewer the applet works and uploads the files. However when I test the applet in a browser , the applet loads but the Upload button doesn't work. No error or nothing it just doesnt work.


the method that is called when you click the Upload button.


[ UD: added linebreak to preserve layout ]
[ July 08, 2008: Message edited by: Ulf Dittmer ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
Have you made sure that this method is in fact called? If it is, which lines of code are executed?

Are there any error messages in the Java Console?

How are you referencing the required jar files in your applet tag?
[ July 08, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
If I test the applet in the applet viewer the method is being run, not when i test the applet inside a browser.

This is how the applet is loaded.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
So are there any error messages in the Java Console?
Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
I cant open the java console since the applet is still running
[ July 08, 2008: Message edited by: Tristan Van Poucke ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
That's unusual. Which OS are you running? In Windows in can be opened from the little Java icon at the lower right of the screen, regardless of whether an applet is running or not. It may need to be turned on first in the Java Plugin control panel.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Originally posted by Tristan Van Poucke:
I cant open the java console since the applet is still running


No idea what you mean there.

In any case, you do realize that browsers have security restrictions in place that prevent applets from doing potentially dangerous things like, for instance, accessing the local file system? Applets that need to do things like this need to be digitally signed, and then need to ask for permission to perform the action.


[Jess in Action][AskingGoodQuestions]
Tristan Van Poucke
Ranch Hand

Joined: Jun 30, 2008
Posts: 47
java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\josy\Mijn documenten\Adinda en weeskindjes al spelend.jpg read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.isFile(Unknown Source)
at org.apache.commons.httpclient.methods.multipart.FilePartSource.<init>(FilePartSource.java:68)
at org.apache.commons.httpclient.methods.multipart.FilePart.<init>(FilePart.java:127)
at UploaderPack.Uploader$8.run(Uploader.java:285)
at java.security.AccessController.doPrivileged(Native Method)
at UploaderPack.Uploader.uploadPictures(Uploader.java:278)
at UploaderPack.Uploader$2$1.run(Uploader.java:110)
at java.security.AccessController.doPrivileged(Native Method)
at UploaderPack.Uploader$2.mouseClicked(Uploader.java:107)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


This is the error I get in java console. I figured it had something to do with security again and since I already signed my applet I tried to sign the commons jars also, didn't work though :s
 
Don't get me started about those stupid light bulbs.
 
subject: Applet doesn't work in browser.
 
Similar Threads
upload file through applet
How to upload a file from applet to the webserver ?
Implementing file upload like CURL
File Permission Error
HttpClient file upload code review