Title: Include java object in post
Last modified: August 19, 2016

---

# Include java object in post

 *  Resolved [dingeman](https://wordpress.org/support/users/dingeman/)
 * (@dingeman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/include-java-object-in-post/)
 * I am trying to include some visualizations I created using [Processing](http://www.processing.org)
   into my posts. Processing exports the visualisation as a java-object and also
   generates some code you can use to include the java-object on a webpage (see 
   below for an example of the code generated by Processing). However, I have trouble
   including this code in WordPress.
 * I switched to the HTML-editor instead of the visual editor. Removing all of the
   linebreaks in the code helped as WordPress stopped inserting `<br />` into the
   code. However, WordPress still causes problems with the comments as the –‘s are
   replaced by m/ndashes.
 * So how do I include this code? I would have expected this question to have been
   asked before, by I could not find it in the archives. Help is appreciated.
 * Regards,
    Jan
 * The html-code generated by Processing:
 *     ```
       <!--[if !IE]> -->
         <object classid="java:test.class" type="application/x-java-applet"
             archive="test.jar" width="700" height="800"
             standby="Loading Processing software..." >
           <param name="archive" value="test.jar" />
           <param name="mayscript" value="true" />
           <param name="scriptable" value="true" />
           <param name="image" value="loading.gif" />
           <param name="boxmessage" value="Loading Processing software..." />
           <param name="boxbgcolor" value="#FFFFFF" />
           <param name="test_string" value="outer" />
       <!--<![endif]-->
         <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
             codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_15-windows-i586.cab"
             width="700" height="800" standby="Loading Processing software..."  >
           <param name="code" value="test" />
           <param name="archive" value="test.jar" />
           <param name="mayscript" value="true" />
           <param name="scriptable" value="true" />
           <param name="image" value="loading.gif" />
           <param name="boxmessage" value="Loading Processing software..." />
           <param name="boxbgcolor" value="#FFFFFF" />
           <param name="test_string" value="inner" />
           <p>
             <strong>This browser does not have a Java Plug-in.<br />
             <a href="http://www.java.com/getjava" title="Download Java Plug-in">
             Get the latest Java Plug-in here. </a></strong>
           </p>
         </object>
       <!--[if !IE]> -->
       </object>
       <!--<![endif]-->
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [dingeman](https://wordpress.org/support/users/dingeman/)
 * (@dingeman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/include-java-object-in-post/#post-1547649)
 * OK I have solved the problem by using [Shortcode](http://codex.wordpress.org/Shortcode_API).
 * I created the following functions.php in my theme directory:
 *     ```
       <?php
         function processing_object($atts, $content = null) {
           extract(shortcode_atts(array('jar' => '', 'class' => '',
               'width' => 700, 'height' => '800'), $atts));
           if ($jar == '' || $class == '') return '<p>Syntax error</p>';
           $result = <<<EOD
       <div id="processing_container">
         <!--[if !IE]> -->
           <object classid="java:$class.class"
               type="application/x-java-applet"
               archive="$jar"
               width="$width" height="$height"
               standby="Loading Processing software..." >
             <param name="archive" value="$jar" />
             <param name="mayscript" value="true" />
             <param name="scriptable" value="true" />
             <param name="image" value="loading.gif" />
             <param name="boxmessage" value="Loading Processing software..." />
             <param name="boxbgcolor" value="#FFFFFF" />
             <param name="test_string" value="outer" />
         <!--<![endif]-->
           <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
               codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_15-windows-i586.cab"
               width="$width" height="$height"
               standby="Loading Processing software..."  >
             <param name="code" value="$class" />
             <param name="archive" value="$jar" />
             <param name="mayscript" value="true" />
             <param name="scriptable" value="true" />
             <param name="image" value="loading.gif" />
             <param name="boxmessage" value="Loading Processing software..." />
             <param name="boxbgcolor" value="#FFFFFF" />
             <param name="test_string" value="inner" />
             <p><strong>This browser does not have a Java Plug-in.<br />
               <a href="http://www.java.com/getjava" title="Download Java Plug-in">Get the latest Java Plug-in here.</a></strong>
             </p>
           </object>
         <!--[if !IE]> -->
           </object>
         <!--<![endif]-->
       </div>
       EOD;
           return $result;
         }
   
         add_shortcode('processing', 'processing_object');
       ?>
       ```
   
 * And could then include the java object by using
 * `[processing jar="test.jar" class="test"]`
 * in my post.
 * Regards,
    Jan
 *  [Matt Montag](https://wordpress.org/support/users/ivionday/)
 * (@ivionday)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/include-java-object-in-post/#post-1547737)
 * Thanks – worked like a charm. Lifesaver.
    Possibly make this a plugin — This 
   will break when I switch to a different theme, right?
 * Matt

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Include java object in post’ is closed to new replies.

## Tags

 * [java](https://wordpress.org/support/topic-tag/java/)
 * [object](https://wordpress.org/support/topic-tag/object/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Matt Montag](https://wordpress.org/support/users/ivionday/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/include-java-object-in-post/#post-1547737)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
