Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Applet doesn't work in browser.

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are there any error messages in the Java Console?
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant open the java console since the applet is still running
[ July 08, 2008: Message edited by: Tristan Van Poucke ]
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Destroy anything that stands in your way. Except this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic