Java Web Start version?

User 870ab5b546

26-02-2016 13:51:55

I understand that browsers are soon going to end their support for Java plugins (). I also understand that there is a substitute technology called Java Web Start. Are you going to release a Java Web Start version of MarvinSketch, or are you going to put all your eggs in the Marvin JS basket?

ChemAxon d26931946c

29-02-2016 12:58:34

Hi Bob,


The WebStart version of Marvin is available for ages. :) We haven't promoted it because the applet is much more customizable.


We have even replaced the applet with the webstart as our demo page.


Click on Try online here: https://www.chemaxon.com/products/marvin/marvinsketch/


However, MarvinJS is much more configurable and we would recommend switching to JS instead of WebStart in all possible cases.


Best regards,


Peter

User 870ab5b546

01-03-2016 16:56:55

When I go to the example page you cite, and I enter https://epoch.uky.edu:#/ace/public/mol3D.txt into the URL field for MarvinView, and I press Start, then all that happens is the browser displays the file mview-jnlp.jsp. I'm using Safari on a Mac, and I have Java 8 update 73 (the most recent version). (I use a specific port number in place of #.)


If I press the MarvinView application link, then an empty MarvinView window opens. But an empty MarvinView window is pretty useless. 


What I would really like is to be able to load an MRV string, not a file, into MarvinView launched via Web Start. Is it possible?


I copied your index.html and mview.jnlp files to our server, and I changed the URLs in mview.jnlp to point to the JChem 16.2.15 folder. When I press the MarvinView link, at first it looks like everything is loading, but then I get an error message, Unable to launch the application. The error is, Found unsigned entry in resource: https://epoch.uky.edu:#/ace/nosession/jchem/lib/com.chemaxon-marvin-app.jar. The Exception window shows:


com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: https://epoch.uky.edu:#/ace/nosession/jchem/lib/com.chemaxon-marvin-app.jar
at com.sun.javaws.security.SigningInfo.getCommonCodeSignersForJar(Unknown Source)
at com.sun.javaws.security.SigningInfo.check(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

What's that about?

User 870ab5b546

07-03-2016 13:21:33

No response?

ChemAxon d26931946c

08-03-2016 13:04:49

Hi Bob,


 


I'm sorry for the late answer.


You may find the updated versions of the webstart examples here.


We've replaced the "Start up with molecule" examples as starting up with a custom molecule would require to generate the jnlp files on the fly, and we didn't wanted to implement that.


The example should provide a good starting ground for most cases.


About the error you're getting: the libs of the webstart should be signed ones. They can be obtained from our download page: https://www.chemaxon.com/download/marvin-suite/#mbeans


Please scroll down for the "Signed versions".


Best regards,


Peter

User 870ab5b546

08-03-2016 14:21:25

Thanks. I want to make sure I do this correctly. When I unzip marvinbeans-lib-16.2.29.0-signed.zip, I get a folder, lib, with a bunch of .jar and .jar.pack.gz files in it. Should I replace the entire directory jchem16.2.29/lib with this new lib? Or should I merge the new lib into the old lib, because there may be files in the old lib that I need and that are not present in the new lib? 


Also, I see that in order to launch MarvinView with a molecule, I need a file called mview-arg.jnlp, but I don't see any way to download it.

User 870ab5b546

08-03-2016 19:58:09










bobgr wrote:

Thanks. I want to make sure I do this correctly. When I unzip marvinbeans-lib-16.2.29.0-signed.zip, I get a folder, lib, with a bunch of .jar and .jar.pack.gz files in it. Should I replace the entire directory jchem16.2.29/lib with this new lib? Or should I merge the new lib into the old lib, because there may be files in the old lib that I need and that are not present in the new lib? 


Also, I see that in order to launch MarvinView with a molecule, I need a file called mview-arg.jnlp, but I don't see any way to download it.



Well, I was able to download the mview-arg.jnlp file because the browser console displayed a Javascript error. But I would suggest you make it a little more user-friendly. 


And I figured out the answer to my first question, which is, Neither! The lib directory containing the signed jar files should be maintained separately from the existing JChem lib directory. When I merged the directories, I got conflicts between signatures, and the web app started doing some funky things; but when I tried to use the new directory excelusively, a lot of jar files went missing.


But now I have a new problem. I have successfully launched MarvinView with a SMILES that I enter on a Web page. But when I enter MOL or MRV data, the program does not launch. Absolutely nothing happens; there is no error in the JavaScript console, and the Java window doesn't appear and begin processing. This is true even if I submit an MRV from which all the return characters have been removed. The code is:


function launchWithStructure() {
var code = document.getElementById('argument').value;
deployJava.launchWebStartApplication('../includes/mview-jnlp.jsp?argument='
+ encodeURIComponent(code));
} // launchWithStructure()

For example, if I enter CCC(O)CO, then MarvinView launches successfully. But if I enter the following string (with or without return characters), it does not. ???


<?xml version="1.0" ?>
<cml>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8" elementType="C C C N C C O C" x3="-0.9605793291129503 -2.153371876432826 -2.514126840989448 -1.474312575600967 -0.28196546845623804 0.296619122761033 0.20425260091903025 -1.451217758123855" y3="1.234344843627626 0.3755871982672688 -0.45266238608531145 0.10348965938596222 -0.3823086523898616 0.34088949101820115 -1.2803930202445126 1.4897323970356278" z3="-0.5764035891388528 -1.138503847393507 0.1341646282453004 0.8868380942208632 0.8336789434568816 -0.2740692997095784 1.5035273249262244 0.8631361155901126" />
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a3 a4" order="1" />
<bond atomRefs2="a4 a5" order="1" />
<bond atomRefs2="a5 a6" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a5 a7" order="2" />
<bond atomRefs2="a1 a8" order="1" />
<bond atomRefs2="a4 a8" order="1" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

We need to have coordinates in our structures, so this is a serious issue for us. Any solutions?

ChemAxon d26931946c

09-03-2016 07:51:49

Hi Bob,


For multi-line formats I suggest to use the url of the source file as a parameter:


<application-desc main-class="chemaxon.marvin.View">
        <argument>https://marvin-demo.chemaxon.com/marvin/examples/evaluator/Friedel-Crafts_acylation.mrv</argument> />    </application-desc>


 


Best regards,


Peter

User 870ab5b546

09-03-2016 13:34:35

That's the thing. We don't have a source file, and we don't want to create one. We want to pass the code to the jnlp file as a URI.


Also, the problem is not just multiline source. I can remove all the return characters from the MRV so that the code consists of a single line, and it still doesn't load. 

ChemAxon d26931946c

09-03-2016 17:12:36

I was refering to SMILES and one-letter peptide notations as single-line formats.


MView needs a file to load from in case of other formats. With Applet, it was possible to load up files like this without generating at least a temporary file to load from. I don't think it's possible to do so in WebStart.


 


Peter

User 870ab5b546

09-03-2016 17:21:54










pcseh wrote:

MView needs a file to load from in case of other formats. 



Maybe I'm misunderstanding what you're saying, but we currently launch the MarvinView applet with molecules in MOL and MRV formats with the following code. So it appears to me that MarvinView does indeed accept molecules in MRV and MOL format. Although I agree that the Web Start verson appears not to do.


/* Method for initiating MarvinView in a jsp page. Requires an
* HTML element with ID = elementId. */
function startMView(width, height, mol, displayFlags, mviewNum, elementId,
qdNum, marvinVersion) {
"use strict";
var isQDatum = !isNaN(qdNum) && qdNum >= 0,
appletBld = new String.builder(),
molParts = (mol + ' ').split('<\/MDocument>'),
numMols = molParts.length - 1;
if (numMols === 0) numMols = 1;
var numCols = (numMols > 2 ? 2 : numMols),
newWidth = width * numCols,
numRows;
if (newWidth < 0) newWidth *= -1;
else if (newWidth > 300) newWidth = 300;
if (isQDatum) {
appletBld.append('<table><tr><td class="boldtext" ' +
'style="text-align:right;font-style:italic;">' +
'MarvinView&trade;' +
'<input type="hidden" id="mviewNumOfQD').
append(qdNum).
append('" value="').
append(mviewNum).
append('" /><\/td><\/tr><tr><td class="whiteTable">');
} // if is qDatum
// multidocument structure to display in table?
mview_name = 'marvinView' + mviewNum;
mview_begin('/nosession/' + marvinVersion, newWidth, height);
if (numMols > 1) {
numRows = (numMols + (numMols % 2)) / 2;
mview_param('rows', numRows);
mview_param('cols', numCols);
mview_param('border', 1);
} // if there's more than one molecule to display
mview_param('mol', mol);
mview_param('molbg', '#FFFFFF');
mview_param('rendering', 'wireframe');
mview_param('valenceErrorVisible', 'true');
mview_param('valencePropertyVisible', 'false');
mview_param('implicitH', getHVisibility(displayFlags));
mview_param('viewCarbonVisibility', getCVisibility(displayFlags));
mview_param('lonePairsVisible', getLonePairsVisible(displayFlags));
mview_param('atomPropertiesVisible', 'false');
mview_param('chiralitySupport', getRSLabelsVisible(displayFlags));
mview_param('atomMappingVisible', getAtomMapping(displayFlags));
// if (width < 0) mview_param('tabScale', 30);
appletBld.append(mview_end_to_string());
if (isQDatum) {
appletBld.append('<\/td><\/tr><\/table>');
}
setInnerHTML(elementId, appletBld.toString());
} // startMView()

ChemAxon d26931946c

10-03-2016 12:56:31

Yes, we've written a wrapper around MView that gave this functionality. Unfortunately, that wrapper can't be used in case of WebStart.


We don't plan on adding this feature to WebStart and suggest to use Marvin JS instead of Marvin Sketch and embedded images instead of Marvin View.


Peter

User 870ab5b546

10-03-2016 16:53:10










pcseh wrote:

Yes, we've written a wrapper around MView that gave this functionality. Unfortunately, that wrapper can't be used in case of WebStart.


We don't plan on adding this feature to WebStart and suggest to use Marvin JS instead of Marvin Sketch and embedded images instead of Marvin View.


 



We already use embedded images as a first choice. We currently allow the user to launch MarvinView when the user wants to manipulate the image, e.g. by rotating it in 3D or by displaying R/S labels. Unfortunately, the fact that the browsers will soon stop supporting Java plugins will make this feature untenable.


Also unfortunately, we can't use Marvin JS because it allows the user to edit the figure. There is currently no view-only version of Marvin JS. I and others have repeatedly asked for one, but the Marvin JS team will not commit to it.


So you see, we have already considered all the options. If you could allow WebStart MarvinView to read structures encoded in multiline formats, it would solve all these problems. If that's out of the question, maybe you can lean on the Marvin JS team for us.

ChemAxon d26931946c

16-03-2016 09:55:49

Hi Bob,


I've mingled around on this issue on the weekend and found out that it's possible to use MView JWS with MRV as a parameter like this:


 


<application-desc main-class="chemaxon.marvin.View">
        <argument><![CDATA[<?xml version="1.0" encoding="UTF-8"?><cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/schema/mrvSchema_16_02_15.xsd" version="ChemAxon file format v16.02.15, generated by v16.3.14.0">
<MDocument><MChemicalStruct><molecule molID="m1"><atomArray atomID="a1 a2 a3 a4 a5 a6 a7" elementType="C C O C C N C" x3="-0.2970198534459908 -0.6024338000811952 0.08700386259096181 -0.13261713155340665 0.655147926289708 0.44685032294569726 1.1352289739103467" y3="1.0584811084039731 1.2624620223880887 0.2646849463893985 0.36948860793278454 -0.7455864806318447 -0.6319356697711274 -1.6659666758932636" z3="6.077805993696732 4.58278999318484 3.805679226982109 2.385173607447284 1.6702540933141925 0.21075050165387246 -0.5838332991106883"></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="1"></bond><bond id="b2" atomRefs2="a2 a3" order="1"></bond><bond id="b3" atomRefs2="a3 a4" order="1"></bond><bond id="b4" atomRefs2="a4 a5" order="1"></bond><bond id="b5" atomRefs2="a5 a6" order="1"></bond><bond id="b6" atomRefs2="a6 a7" order="1"></bond></bondArray></molecule></MChemicalStruct></MDocument>
</cml>]]></argument>
    </application-desc>



 


Best regards,


Peter

User 870ab5b546

16-03-2016 16:48:48

Thanks for continuing to investigate this. Unfortunately, it's not working for me. Java launches, but I get an error message, Unable to launch the application.


java.lang.NullPointerException
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

My code:


    var param = new String.builder().
append(pathToRoot).
append('includes/mview-jnlp.jsp?argument=<![CDATA[').
append(mol).
append(']]>').
toString();
deployJava.launchWebStartApplication(param);

It works fine when mol is SMILES, but not when it is MRV. I tried the MRV that you showed above. Can you see anything I'm doing wrong?

ChemAxon d26931946c

17-03-2016 08:03:28

You can only use the CDATA element inside the jnlp file and can't use it inside an URL.


You'll have to dynamically generate the whole jnlp file and pass that to the browser to load in.


BRs


Peter


 


Edit: Have you tried applying URL escaping on the mol string? Newlines and whitespaces have to be handled in a special way in URLs.

User 870ab5b546

17-03-2016 11:50:18

I did try using encodeURIComponent() on the structure code, including the <?[CDATA[ part, but it didn't help.


So either I write the MRV to a file, and pass the file's URL to a JSP page that generates the JNLP dynamically, or I write the JNLP page to a file. Either way, I write to a file, which is what I would like to avoid, if possible.


The worst thing about all this is that I was hoping that Chrome would run MarvinView if it was delivered via Java Web Start instead of as an applet, but it doesn't appear to do. So I'm not sure what all this effort has gained me.

ChemAxon d26931946c

17-03-2016 14:27:49

Yes, if you want to make it work in Chrome, you would have to create a file dynamically and pass that file to the browser to download it.


The user then can download and run the jnlp with java web start. See an example for this here.


We understand that this is not convenient to use, but Java is going out of business for web frontend world.

User 870ab5b546

17-03-2016 15:39:29

Thanks for the coding tip. Yes, I understand Java is going away as a Web tool. But again, this is a stopgap measure until a JavaScript version of MarvinView is available (essentially MarvinJS without the editing ability but with the ability to call Web Services).

User 870ab5b546

10-06-2016 01:25:05

In JChem 16.4.25, when I try to launch MarvinView by Web Start, I get most of the way through the launching process, including a question about whether I want to run the applet, but then I get the error message shown in the screen shot. I have downloaded the signed version of the jar files of JChem and put them in the JChem directory in their own directory called signedLib. Are you sure that the jar files are all signed properly for this version and later versions?

User 870ab5b546

13-06-2016 17:15:28

I figured it out. I needed the signed jar files of Marvin, not JChem. I don't understand why they're different, but regardless, the problem is now solved.