Integrating Sweet Home 3D Viewer in a webpage

This topic has been viewed 6209 times and has 13 replies
Thread status: Active
How can I do this? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

Hi,

I'm using an online web creation service which allows me to upload files to my website but does not allow me to insert the files into folders.

Therefore, all my files for Sweet Home 3D Viewer are in the following URL : www.mywebsite.com/files/theme/

Having uploaded the files to the theme folder (no other folders possible) I changed the HTML script as follows to add the applet to my website :

Code: Select all

<!--
   SweetHome3DViewer.html 31 Mar 2009
   
   Sweet Home 3D, Copyright (c) 2009-2013 Emmanuel PUYBARET / eTeks <[email protected]>
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-->
<script language="JavaScript" src="http://java.com/js/deployJava.js">
</script>
<script>
  var javaMinimumVersion = "1.6.0_10"; // The first version with Java Plugin 2
  var jars = "files/theme/SweetHome3DViewer.jar,files/theme/batik-svgpathparser-1.7.jar";
  // Append Java 3D Jars depending on the platform
  if (navigator.platform.match("Win.*")) {
    if (navigator.platform.match(".*64")) {
      jars += ",files/theme/java3d_windows_x64.jar";
    } else {
      jars += ",files/theme/java3d_windows_i386.jar";
    } 
  } else if (navigator.platform.match("Mac.*")) {
    javaMinimumVersion = "1.5";
    jars += ",files/theme/java3d_macosx.jar";
  } else if (navigator.platform.match("Linux.*")) {
    javaMinimumVersion = "1.6"; // OpenJDK doesn't give its subversion 
    if (navigator.platform.match(".*64")) {
      jars += ",files/theme/java3d_linux_x64.jar";
    } else {
      jars += ",files/theme/java3d_linux_i386.jar";
    } 
  } else {
    jars += ",files/theme/java3d.jar";
  }

  var attributes = {codebase:"http://shibu-q.weebly.com/files/theme/",
                    code:"SweetHome3DViewer.jar",
                    archive:jars,
                    width:"100%", height:"100%",
                    name:"SweetHome3DViewer"};
  var parameters = {java_arguments:"-Xmx640m",
                    navigationPanel:"true",
                    homeURL:"http//shibu-q.weebly.com/files/theme/default.sh3d",
                    // JNLP file converted to Base 64 encoding with "base64 -i SweetHome3DViewer.jnlp" command
                    jnlp_embedded:"PD94bWwgdmVyc2lvbj0iMS4wIj8+CjwhLS0KICAgU3dlZXRIb21lM0RWaWV3ZXIuam5scCAKICAgCiAgIFN3ZWV0IEhvbWUgM0QsIENvcHlyaWdodCAoYykgMjAxMyBFbW1hbnVlbCBQVVlCQVJFVCAvIGVUZWtzIDxpbmZvQGV0ZWtzLmNvbT4KICAgCiAgIFRoaXMgcHJvZ3JhbSBpcyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CiAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2UgYXMgcHVibGlzaGVkIGJ5CiAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yCiAgIChhdCB5b3VyIG9wdGlvbikgYW55IGxhdGVyIHZlcnNpb24uCiAKICAgVGhpcyBwcm9ncmFtIGlzIGRpc3RyaWJ1dGVkIGluIHRoZSBob3BlIHRoYXQgaXQgd2lsbCBiZSB1c2VmdWwsCiAgIGJ1dCBXSVRIT1VUIEFOWSBXQVJSQU5UWTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJhbnR5IG9mCiAgIE1FUkNIQU5UQUJJTEl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gYXJjaD0iYW1kNjQgeDg2XzY0Ij4KICAgIDxqYXIgaHJlZj0ibGliL2xpbnV4L3g2NC9qYXZhM2QuamFyIi8+CiAgPC9yZXNvdXJjZXM+CgogIDxyZXNvdXJjZXMgb3M9IlN1bk9TIj4KICAgIDxleHRlbnNpb24gaHJlZj0iaHR0cDovL2Rvd25sb2FkLmphdmEubmV0L21lZGlhL2phdmEzZC93ZWJzdGFydC9yZWxlYXNlL2phdmEzZC0xLjUtbGF0ZXN0LmpubHAiLz4KICA8L3Jlc291cmNlcz4KCiAgPGFwcGxldC1kZXNjIG1haW4tY2xhc3M9ImNvbS5ldGVrcy5zd2VldGhvbWUzZC5hcHBsZXQuU3dlZXRIb21lM0RWaWV3ZXIiIAogICAgICAgICAgICAgICBuYW1lPSJTd2VldEhvbWUzRFZpZXdlciIgd2lkdGg9IjYwMCIgaGVpZ2h0PSI2MDAiLz4KPC9qbmxwPg=="};
   
  deployJava.setInstallerType("kernel");
  deployJava.setAdditionalPackages("javax.swing,javax.imageio");
  deployJava.runApplet(attributes, parameters, javaMinimumVersion);
</script>


However, when I try to launch the app on my website, I get the following error :
That is normal since the file is not in the lib folder. It is in the theme folder.

Is there any way to fix this ?

Thank you,
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by Puybaret »

Actually, the changes you made on the value of the jars variable and codebase attribute have an effect only with Java 6. Under Java 7 and further, I think that the JRE always uses the jnlp_embedded parameter after decoding it from Base 64.
As the jnlp_embedded parameter proposed in the default configuration tries to download jar files from lib subfolder, that would explain the error you reported. To fix it, you should download the SweetHome3DViewer.jnlp file that was used to generate the current value of the jnlp_embedded parameter, update the href attribute of its <jar> elements with a text editor and save it. Then, convert the modified file to Base 64 and copy the encoded string in jnlp_embedded parameter.

By the way, there must be a typo in your homeURL parameter where a colon is missing after http.
Emmanuel Puybaret, Sweet Home 3D creator
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

Thank you for your reply.

I tried what you suggested. However, now, the app doesn't even show up on the website.

I got the following code from the BASE64 encryption :

Code: Select all

PD94bWwgdmVyc2lvbj0iMS4wIj8+Cg0KPCEtLQogICANClN3ZWV0SG9tZTNEVmlld2VyLmpubHAN
CiAKICAgCiAgIA0KU3dlZXQgSG9tZSAzRCwgQ29weXJpZ2h0IChjKSAyMDEzIEVtbWFudWVsIFBV
WUJBUkVUIC8gZVRla3MgPGluZm9AZXRla3MuY29tPgogDQogIAogICANClRoaXMgcHJvZ3JhbSBp
cyBmcmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5CiAg
IA0KaXQgdW5kZXIgdGhlIHRlcm1zIG9mIHRoZSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSBh
cyBwdWJsaXNoZWQgYnkKICAgDQp0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uOyBlaXRoZXIg
dmVyc2lvbiAyIG9mIHRoZSBMaWNlbnNlLCBvcgogICANCihhdCB5b3VyIG9wdGlvbikgYW55IGxh
dGVyIHZlcnNpb24uDQoKIAogICANClRoaXMgcHJvZ3JhbSBpcyBkaXN0cmlidXRlZCBpbiB0aGUg
aG9wZSB0aGF0IGl0IHdpbGwgYmUgdXNlZnVsLAogICANCmJ1dCBXSVRIT1VUIEFOWSBXQVJSQU5U
WTsgd2l0aG91dCBldmVuIHRoZSBpbXBsaWVkIHdhcnJhbnR5IG9mCiAgIA0KTUVSQ0hBTlRBQklM
SVRZIG9yIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFLiAgU2VlIHRoZQogICANCkdO
VSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGZvciBtb3JlIGRldGFpbHMuCgogICANCg0KWW91IHNo
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ogICAgDQo8amFyIGhyZWY9ImphdmEzZF9saW51eF94NjQuamFyIi8+DQoKPC9y
ZXNvdXJjZXM+CgogIA0KDQo8cmVzb3VyY2VzIG9zPSJTdW5PUyI+CiAgICANCjxleHRlbnNpb24g
aHJlZj0iaHR0cDovL2Rvd25sb2FkLmphdmEubmV0L21lZGlhL2phdmEzZC93ZWJzdGFydC9yZWxl
YXNlL2phdmEzZC0xLjUtbGF0ZXN0LmpubHAiLz4KICANCjwvcmVzb3VyY2VzPgoKICANCg0KPGFw
cGxldC1kZXNjIG1haW4tY2xhc3M9ImNvbS5ldGVrcy5zd2VldGhvbWUzZC5hcHBsZXQuU3dlZXRI
b21lM0RWaWV3ZXIiIAoNCiAgICAgICAgICAgICAgIG5hbWU9IlN3ZWV0SG9tZTNEVmlld2VyIiB3
aWR0aD0iNjAwIiBoZWlnaHQ9IjYwMCIvPg0KCjwvam5scD4=
I got the code by encrypting this text file :

Code: Select all

<?xml version="1.0"?>

<!--
   
SweetHome3DViewer.jnlp
 
   
   
Sweet Home 3D, Copyright (c) 2013 Emmanuel PUYBARET / eTeks <[email protected]>
 
  
   
This program is free software; you can redistribute it and/or modify
   
it under the terms of the GNU General Public License as published by
   
the Free Software Foundation; either version 2 of the License, or
   
(at your option) any later version.

 
   
This program is distributed in the hope that it will be useful,
   
but WITHOUT ANY WARRANTY; without even the implied warranty of
   
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   
GNU General Public License for more details.

   

You should have received a copy of the GNU General Public License
   
along with this program; if not, write to the Free Software
   
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  
02111-1307  USA

-->

<!-- 
  
Accompanying JNLP file for Sweet Home 3D Viewer.
  
Should match the applet script in SweetHome3DViewer.html and used 
  
as its jnlp_embedded parameter value after a conversion to base64.
  
Under Unix, conversion to base64 can be done with the following command:
    
base64 -i SweetHome3DViewer.jnlp" 

-->

<jnlp href="SweetHome3DViewer.jnlp">
  
<information>
    
<title>Sweet Home 3D Viewer</title>
    
<vendor>eTeks</vendor>
    
<homepage href="http://www.sweethome3d.com/"/>
  
</information>

  

<security>
    
<all-permissions/>
  
</security>

  

<resources>
    
<j2se version="1.5+" max-heap-size="640m"/>
    
<jar href="SweetHome3DViewer.jar" main="true"/>
    
<jar href="batik-svgpathparser-1.7.jar"/>
    
<property name="jnlp.packEnabled" value="false"/>
  
</resources>
 
  

<resources os="Windows" arch="x86">
    
<jar href="java3d_windows_i386.jar"/>
  
</resources>
  

<resources os="Windows" arch="amd64">
    
<jar href="java3d_windows_x64.jar"/>
  
</resources>

  

<resources os="Mac OS X">
    
<property name="apple.awt.graphics.UseQuartz" value="true"/>
    
<property name="j3d.rend" value="jogl"/>
    
<jar href="java3d_macosx.jar"/>
  
</resources>

  

<resources os="Linux" arch="x86 i386">
    
<jar href="java3d_linux_i386.jar"/>
  
</resources>
  

<resources os="Linux" arch="amd64 x86_64">
    
<jar href="java3d_linux_x64.jar"/>

</resources>

  

<resources os="SunOS">
    
<extension href="http://download.java.net/media/java3d/webstart/release/java3d-1.5-latest.jnlp"/>
  
</resources>

  

<applet-desc main-class="com.eteks.sweethome3d.applet.SweetHome3DViewer" 

               name="SweetHome3DViewer" width="600" height="600"/>

</jnlp>
Could you help me, please ?
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

Alright, I managed to code it right.
Apparantly, it needed to be encoded with a certain character encryption.

Anyway, now I have another problem.
The app loads correctly. But after loading, it stays blank or I get a JNLP Signing Exception error.
It reads "Cannot validate signature of the launch file. The version signed does not correspond to the version downloaded."

Could you help me, please ?
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

I've tried to see where this error could come from.
Apparently, just modifying a tiny bit the jnlp file then converting it generates this error.
That is quite bothering if I cannot modify this file...
I have no idea of how the Java signatures work.
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

I've tried to modify the SweetHome3DViewer.jar and changing the JNLP file inside it.
Now I get a NullPointerException.
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by Puybaret »

I forgot about the JNLP file in the SweetHome3DViewer.jar that should match the one you change. Updating it in the jar file isn't enough, you will have also to sign again all the jars with your own software certificate to make it work. If you don't have a certificate, you may try also to simply remove the JNLP file from SweetHome3DViewer.jar. I think it will work but the JRE will display a warning.
Emmanuel Puybaret, Sweet Home 3D creator
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

Alright, I tried what you suggested.
I get a ClassNotFoundException error.
It says the class com.eteks.sweethome3d.applet.SweetHome3DViewer cannot be found.
This is strange as it is in fact inside the JAR file...
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

I forgot to mention what I actually did.

Since I don't have any certificates, I tried removing the JNLP.
I removed the JNLP folder in the JAR and I removed every references to the JNLP file from the MANIFEST file inside the META-INF folder.

After this, I repacked the JAR file.
I removed the references to the JNLP from the HTML file and tried to load it.

After the app has loaded, I get the error previously mentionned.
KenowaX
Posts: 10
Joined: Wed Nov 26, 2014 2:54 pm
Country: Erquelinnes, Hainaut, Belgique

Re: Integrating Sweet Home 3D Viewer in a webpage

Post by KenowaX »

In case you need the codes, here they are :

Code: Select all

<!--
   SweetHome3DViewer.html 31 Mar 2009
   
   Sweet Home 3D, Copyright (c) 2009-2013 Emmanuel PUYBARET / eTeks <[email protected]>
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-->
<script language="JavaScript" src="http://java.com/js/deployJava.js">
</script>
<script>
  var javaMinimumVersion = "1.6.0_10"; // The first version with Java Plugin 2
  var jars = "SweetHome3DViewer.jar,batik-svgpathparser-1.7.jar";
  // Append Java 3D Jars depending on the platform
  if (navigator.platform.match("Win.*")) {
    if (navigator.platform.match(".*64")) {
      jars += ",java3d_windows_x64.jar";
    } else {
      jars += ",java3d_windows_i386.jar";
    } 
  } else if (navigator.platform.match("Mac.*")) {
    javaMinimumVersion = "1.5";
    jars += ",java3d_macosx.jar";
  } else if (navigator.platform.match("Linux.*")) {
    javaMinimumVersion = "1.6"; // OpenJDK doesn't give its subversion 
    if (navigator.platform.match(".*64")) {
      jars += ",java3d_linux_x64.jar";
    } else {
      jars += ",java3d_linux_i386.jar";
    } 
  } else {
    jars += ",java3d.jar";
  }

  var attributes = {codebase:"http://shibu-q.weebly.com/files/theme/",
                    code:"SweetHome3DViewer",
                    archive:jars,
                    width:"100%", height:"100%",
                    name:"SweetHome3DViewer"};
  var parameters = {java_arguments:"-Xmx640m",
                    navigationPanel:"true",
                    homeURL:"http://shibu-q.weebly.com/files/theme/default.sh3d"};
   
  deployJava.setInstallerType("kernel");
  deployJava.setAdditionalPackages("javax.swing,javax.imageio");
  deployJava.runApplet(attributes, parameters, javaMinimumVersion);
</script>
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests