Answers.Body: <p>It looks like the archive path is incorrect.
  You can make it an absolute path by assigning it to the template from php:</p>
  
  <pre><code>$path = CRM_Extension_System::singleton()-&gt;getMapper()-&gt;keyToBasePath('myextension');
  $this-&gt;assign('basePath', $path);
  </code></pre>
  
  <p>Your archive url can then begin with the smarty variable <code>{$basePath}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-22T19:02:14.357Z
Answers.Text: Coleman, thanks. I was able to use this to get the path that I needed. I was finally able to get qzprint working and now I am able to print barcodes/labels from my extension!
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-11T15:46:06.863Z
Answers.LastActivityDate: 2015-06-11T15:46:06.863Z
Answers.UserDisplayName: Coleman
Body: <p>Does anyone have any idea how to get a Java Applet to work in a CiviCRM Extension? In particular, I'm trying to load the QZ-Print applet. </p>
  
  <p>The first problem I'm having is getting the location of the jar. Currently the code to embed the applet is (where the applet is in www/qz-print/ dir on the localhost):</p>
  
  <pre><code>&lt;applet id="qz" name="QZ Print Plugin" code="qz.PrintApplet.class" archive="/qz-print/qz-print.jar" width="100" height="100"&gt;&lt;/applet&gt;
  </code></pre>
  
  <p>The code is in the main page TPL file for my extension. This seems to (sometimes) completely hang the web page/browser... On the occasion where it does load the page, I get the following: "SecurityException JAR should not contain JNLP-INF/APPLICATION.JNLP".</p>
  
  <p>Anyways, I'm at a loss for what to do right now. Any help on getting an applet to work with an extension would be greatly appreciated.</p>
  
  <p>UPDATE:
  So I looked into this and realized that I need to load the JNLP file. So I'm doing that now. HOWEVER, I'm having trouble getting the path to the jnlp/jar file. When working with an extension paths aren't typical.</p>
  
  <p>How does one go about getting the path to the JAR/JNLP within an extension?</p>
  
  <p>Thanks!</p>
  
Tags: <extension>
Title: Using a Java Applet in CiviCRM Extension
ThreadText: # Using a Java Applet in CiviCRM Extension
  
  (Asked by: username_0 on 2015-06-11)
  
  Does anyone have any idea how to get a Java Applet to work in a CiviCRM Extension? In particular, I'm trying to load the QZ-Print applet.
  
  The first problem I'm having is getting the location of the jar. Currently the code to embed the applet is (where the applet is in www/qz-print/ dir on the localhost):
  
  ```
  <applet id="qz" name="QZ Print Plugin" code="qz.PrintApplet.class" archive="/qz-print/qz-print.jar" width="100" height="100"></applet>
  
  ```
  
  The code is in the main page TPL file for my extension. This seems to (sometimes) completely hang the web page/browser... On the occasion where it does load the page, I get the following: "SecurityException JAR should not contain JNLP-INF/APPLICATION.JNLP".
  
  Anyways, I'm at a loss for what to do right now. Any help on getting an applet to work with an extension would be greatly appreciated.
  
  UPDATE:
  So I looked into this and realized that I need to load the JNLP file. So I'm doing that now. HOWEVER, I'm having trouble getting the path to the jnlp/jar file. When working with an extension paths aren't typical.
  
  How does one go about getting the path to the JAR/JNLP within an extension?
  
  Thanks!
  
  **Tags:** extension
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-06-11. Score: 2 | Accepted answer
  
  It looks like the archive path is incorrect.
  You can make it an absolute path by assigning it to the template from php:
  
  ```
  $path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('myextension');
  $this->assign('basePath', $path);
  
  ```
  
  Your archive url can then begin with the smarty variable `{$basePath}`
  
  > **Comments:**
  > **username_0**: username_1, thanks. I was able to use this to get the path that I needed. I was finally able to get qzprint working and now I am able to print barcodes/labels from my extension!  
  
  ---
  
  