PDFUrl is null...
If I'm right the Applet is executed client side, by the client computerCorrect.
but the jar file (which contains the /files /icons ressources) is located on the server.But it is downloaded to the client.
When I test the Applet with NetBeans, there is no problem (if I give the correct path to the method of course).The basic question here, which you still haven't addressed, is whether the PDF inside the JAR file or somewhere else. getResource() will only load it from the JAR file if (a) that's where the class came from and (b) the PDF is in the JAR file. It's different in Netbeans because it is using build/classes instead of the JAR file as the CLASSPATH, so it can load directly from the disk.
But when testing from any browser (outside NetBeans) I got a null pointer for the PDFUrl.
The browser won't let no process read or write files ?The Java Plugin won't let you do that unless you sign the applet or the .policy file permits it.
That is the reason why I added some security policies in the clients's jvm as I did for the server for the tests with the browser in local (loopback).Don't do that. Deployment problems. Arguments with customers. Too hard. Sign the applet.
If there is nothing present in the java.policy file I can not connect to the database, cannot print and of course cannot read/write (when I did my tests with NetBeans I got security exception when trying to connect to the database, for example,...).Sign the applet.
I have not a deep knowledge of the java Applet environnement and I may have underestimated the complexity of "simply read/write a file" on the remote computer.So the PDF isn't in the JAR file? So it's expected to be in the client file system? In that case you can't use getResource() at all, you have to use File, FileInputStream, FileReader, etc.
I assume that the Applet is unpacked in the local file system (even in memory).The JAR file(s) is/are unpacked in memory. If the PDF isn't in the JAR file it isn't unpacked.
Do you think I have a good vision of how the Applet technology is working ? Or there is something important I missed ?(a) No (b) yes.
I dug to find out how to sign the Applet and I'm a little lost.
303232 Wed Oct 17 18:33:40 CEST 2012 cssmbulletins/files/Professionnel.pdf 306399 Wed Oct 17 18:33:40 CEST 2012 cssmbulletins/files/Technique.pdf 252960 Wed Oct 17 21:30:26 CEST 2012 cssmbulletins/files/newTransition.pdf 230602 Wed Oct 17 18:33:40 CEST 2012 cssmbulletins/files/oldTransition.pdf
I did a jar -tvf on the CSSMBulletins.jar... here is the selected results:What package is CMSBulletins.class in?
I dug to find out how to sign the Applet and I'm a little lost.It's a start. Ideally you should purchase a code signing certificate and sign with that. That gets rid of a browser dialog.
NetBeans offers to sign the Applet automatically (self-signing), is that sufficient ?
Is there a particular way to sign a .jar file ?The jarsigner tool; the Ant jarsigner task; the Netscape thing you found; ...
Is that transparent to the end-user (because I had at least four messages asking me to trust the Applet or not but it hasn't solved the issue, with the self-signing feature at least) ?That's because of the self-signed certificate. See above.
EJP wrote:Which is why you can nearly always get away with using a self-signed certificate. I've been party myself to installing software for commercial use which used a self-signed certificate and I never heard of any of our customers objecting.
I'm always so glad to get rid of the dialogs that I don't take much notice of them.