Note that there are some explanatory texts on larger screens.

plurals
  1. POViewing word office document in java applet inside firefox
    text
    copied!<p>I am trying to view a .doc/.docx microsoft word files in a webpage on firefox. When all failed i tried creating an applet that will hold an instance of Word OLE to view the document.</p> <p>I created the applet using: org.eclipse.swt.ole.win32.OleClientSite, and with in eclipse it works fine and i can see Word inside.</p> <p>I created a .jar file and i tried to use the applet inside the webpage in firefox. The applet starts but i can't see anything inside.</p> <p>Here is my applet code:</p> <pre><code>import java.applet.Applet; public class JWordViewer extends Applet { org.eclipse.swt.widgets.Display display; org.eclipse.swt.widgets.Shell swtParent; java.awt.Canvas awtParent; public void init() { Thread thread = new Thread(new Runnable() { public void run() { setLayout(new java.awt.GridLayout(1, 1)); awtParent = new java.awt.Canvas(); add(awtParent); display = new org.eclipse.swt.widgets.Display(); swtParent = org.eclipse.swt.awt.SWT_AWT.new_Shell(display, awtParent); swtParent.setLayout(new org.eclipse.swt.layout.FillLayout()); org.eclipse.swt.ole.win32.OleFrame frame = new org.eclipse.swt.ole.win32.OleFrame( swtParent, org.eclipse.swt.SWT.NONE); org.eclipse.swt.ole.win32.OleClientSite site; try { site = new org.eclipse.swt.ole.win32.OleClientSite(frame, org.eclipse.swt.SWT.NONE, "Word.Document"); } catch (org.eclipse.swt.SWTException e) { String str = "Create OleClientSite Error" + e.toString(); System.out.println(str); return; } setSize(500, 500); validate(); site.doVerb(org.eclipse.swt.ole.win32.OLE.OLEIVERB_SHOW); while (swtParent != null &amp;&amp; !swtParent.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }); thread.start(); } public void stop() { if (display != null &amp;&amp; !display.isDisposed()) { display.syncExec(new Runnable() { public void run() { if (swtParent != null &amp;&amp; !swtParent.isDisposed()) swtParent.dispose(); swtParent = null; display.dispose(); display = null; } }); remove(awtParent); awtParent = null; } } } </code></pre> <p>`</p> <p>Any idea why isn't it working?</p> <p>Here is what the Java Console says:</p> <p><code>basic: Told clients applet is started Exception in thread "Thread-11" java.lang.ExceptionInInitializerError at org.eclipse.swt.widgets.Display.&lt;clinit&gt;(Display.java:130) at JWordViewer$1.run(JWordViewer.java:17) at java.lang.Thread.run(Unknown Source) Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission sun.arch.data.model 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.checkPropertyAccess(Unknown Source) at java.lang.System.getProperty(Unknown Source) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:167) at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151) at org.eclipse.swt.internal.C.&lt;clinit&gt;(C.java:21) ... 3 more </code></p> <p>And that's after i told it to trust this applet...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload