Differences between revisions 5 and 6
Revision 5 as of 2006-01-17 14:39:45
Size: 11606
Editor: cumin
Comment:
Revision 6 as of 2006-01-17 14:40:16
Size: 20251
Editor: cumin
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Note: this page is out of date and will be updated. =
Line 17: Line 16:

---- /!\ '''Edit conflict - other version:''' ----
Line 22: Line 23:
---- /!\ '''Edit conflict - your version:''' ----
There is a template Cytoscape JNLP file cy1.jnlp in the cytoscape build directory. Excerpts of this file are shown here:

 
1. The header section

---- /!\ '''End of edit conflict''' ----
Line 25: Line 34:

---- /!\ '''Edit conflict - other version:''' ----
Line 31: Line 42:

---- /!\ '''Edit conflict - your version:''' ----
   codebase="http://chianti.ucsd.edu/kono/"
   href="cy1.jnlp">
  <information>
    <title>Cytoscape WebStart</title>
    <vendor>Cytoscape Collaboration</vendor>
    <homepage href="index.html"/>

---- /!\ '''End of edit conflict''' ----
Line 36: Line 57:

---- /!\ '''Edit conflict - other version:''' ----
Line 63: Line 86:

---- /!\ '''Edit conflict - your version:''' ----
}}}

2. The resources section, where any jar files that are part of the application must be listed
{{{
  <resources>
    <j2se version="1.4+" max-heap-size="1024M"/>
<jar href="cytoscape.jar"/>
<jar href="lib/fing.jar"/>
<jar href="lib/coltginy.jar"/>
...
<jar href="plugins/browser.jar"/>
<jar href="plugins/control.jar"/>
...
<jar href="data.jar"/>
}}}

3. The Cytoscape command line arguments section
{{{
  <application-desc main-class="cytoscape.CyMain">
        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>
        <argument>-rp</argument>
        <argument>control.ControlPlugin</argument>
...
  </application-desc>
</jnlp>


---- /!\ '''End of edit conflict''' ----
Line 73: Line 127:

---- /!\ '''Edit conflict - other version:''' ----
Line 75: Line 131:
---- /!\ '''Edit conflict - your version:''' ----
'''Resources:''' These fields point Web Start to the jar files it should load. There are three types of jar files needed in Cytoscape webstart: (1) cytoscape.jar and library jar files, (2) plugin jar files (this includes any of your own plugins that you want to use, and (3) data jar files. All of your data must be packed into one or more jar files. By default, the automated build process packs all data files into a data.jar file.

---- /!\ '''End of edit conflict''' ----
Line 77: Line 138:

---- /!\ '''Edit conflict - other version:''' ----
Line 130: Line 193:
---- /!\ '''Edit conflict - your version:''' ----
'''Application arguments:''' Cytoscape requires command-line arguments to tell it what to do. The argument fields under the "application-desc" section provide these arguments. The most commonly-used arguments for webstart are -rp for specifying plugins, -g or -i for specifyig network data, and -e for specifying expression data.

If you you want to add a plugin to a Cytoscape webstart bundle, there are two modifications you will need to make to the .jnlp file.

1. In the resources section, add a jar declaration to include the plugin. For example:

{{{
<jar href="plugins/browser.jar"/>
}}}

2. In the application-desc section, add a runtime argument to specify the class that extends CytoscapePlugin. For example:

{{{
        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>
}}}

where browser.BrowserPlugin specifies the class that extends CytoscapePlugin.

If you have a data file to be loaded automatically in your Cytoscape webstart bundle, you will need to specify it in your .jnlp file with the jar:// syntax. For instance, if you want to load the network galFiltered.sif automatically, you should:
1. see that galFiltered.sif gets into your data.jar file (described below),
2. make sure your .jnlp file loads your data.jar file

{{{
<jar href="data.jar"/>
}}}

3. specify the galFiltered.sif with command line arguments, as follows:

{{{
<argument>-i</argument>
<argument>jar:://galFiltered.sif</argument>
}}}

Note that this works for networks and expression matrix files, but does not currently work for vizmap.props or cytoscape.props files. For other types of files, check for information on the cytoscape-discuss mailing list.
}}}

== Building a webstart bundle ===

To build your own Cytoscape webstart bundle, you will need to do the following things:
1. Set up a key to sign your JAR files with (described in detail below)
2. Check out the Cytoscape source code from CVS, and go to the build directory (the one that contains the file build.xml).
3. Gather all the data files you will need to be loaded automatically (networks, expression matrix files, etc), and put them in the data subdirectory of the cytoscape build directory.
4. Put all the plugin jars you will need in the plugins subdirectory
5. Issue the command "ant webstart"
6. Copy all files and subdirectories from the build/webstart directory
7. Take the template file cy1.jnlp from the build/webstart directory, add jar declarations for any special plugins you have,
modify the command line arguments for any plugins and data files you are using (discussed further below).
8. Put this whole bundle in a place where you can point to it with a URL
9. Modify the href and codebase lines of your .jnlp file accordingly.
10. Write a web page with a link that points to your JNLP file.
11. If you did everything correctly, and your browser is properly enabled, you should be able to click on the link and run Cytoscape. Alternatively, you can directly run your Java Web Start executable (usually called javaws) with the JNLP file as an argument. For example, on Linux: javaws cy.jnlp.

---- /!\ '''End of edit conflict''' ----
Line 132: Line 251:

---- /!\ '''Edit conflict - other version:''' ----
Line 134: Line 255:
---- /!\ '''Edit conflict - your version:''' ----
Because Cytoscape runs with all permissions, you *must* sign all of your jar files, or Web Start will refuse to run the program. In addition, all of the jar files must be signed using the same key, and every jar can only be signed once. This can present problems if you want to take a Cytoscape webstart bundle originally built by someone else and change a few jar files (such as data.jar).

---- /!\ '''End of edit conflict''' ----
Line 136: Line 262:

---- /!\ '''Edit conflict - other version:''' ----
Line 138: Line 266:
---- /!\ '''Edit conflict - your version:''' ----
First, you have to generate an encryption key, which will live in a personal keystore. You will need to do this only once. You do this with

---- /!\ '''End of edit conflict''' ----
Line 140: Line 273:

---- /!\ '''Edit conflict - other version:''' ----
Line 146: Line 281:
---- /!\ '''Edit conflict - your version:''' ----
You will be prompted for a password for this key. In addition, if this is the first key you've ever made, you will be prompted for some personal information and a password for your keystore; by default your encryption keys are stored in the file ".keystore" in your home directory. To make this easiest of yourself, generate a key with the command

{{{keytool -genkey -alias cytoscape -keypass secret}}}

and enter "secret" for the password. If you do this, the Cytoscape build procedure will sign your jars for you automatically. If instead you want to sign your jars manually, you can do so with the jarsigner command.

---- /!\ '''End of edit conflict''' ----
Line 150: Line 294:

---- /!\ '''Edit conflict - other version:''' ----

---- /!\ '''Edit conflict - your version:''' ----

---- /!\ '''End of edit conflict''' ----
Line 154: Line 304:

---- /!\ '''Edit conflict - other version:''' ----
Line 155: Line 307:

---- /!\ '''Edit conflict - your version:''' ----
A surprising number of errors are caused by spelling a name wrong, either a control key, the name of a file, or a parameter value. Often such errors don't create a visible error message, but make things unexpectedly not work. For example, if you misspell the name of a data file in data.jar, you will quietly see no data. Triple check all of your spelling.

---- /!\ '''End of edit conflict''' ----
Line 159: Line 316:

---- /!\ '''Edit conflict - other version:''' ----
Line 166: Line 325:
---- /!\ '''Edit conflict - your version:''' ----
 * Make sure your JNLP file references the right jar files.
 * If you have added some plugins, make sure you have specified them with the --rp switch, specifying the class that extends CytoscapePlugins. If you specify the wrong class, you will get an undecipherable null pointer error message.
 * Make sure you put all the files in the data.jar that were supposed to be there. Use "jar tf data.jar" to see the contents of the jar.
 * If you are a glutton for punishment and are not using the automated build procedure, make sure that all jar files (including data.jar) are signed with the same key.

Note that Cytoscape will read the user's personal configuration files, if available. If the user has no personal configuration files available, then Cytoscape will use default configuration data. This may cause the application to behave differently for different users.

---- /!\ '''End of edit conflict''' ----

Introduction

This page explains how to set up your own Cytoscape application to run via Java Web Start. For help running an existing Web Start, see the [http://cytoscape.systemsbiology.net/Cytoscape2.0/user/JavaWebStart/webStart.html basic web start documentation].

Setting up Cytoscape for Java Web Start is tricky. There are lots of little detailed steps and if you get any one wrong, it won't work. Expect to get it wrong about 5 times before you get it right (we always do).

Documentation on Java Web Start itself is at [http://java.sun.com/products/javawebstart/developers.html]

In particular, specific documentation on setting up a Web Start application is at [http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html]

After reading this page, get one of our web starts, see how it works, and then do the same thing with your files. Try the tutorial directory at http://cytoscape.systemsbiology.net/tutorial/yeast0/. Just download all of the files in this directory, then look at them. cy.jnlp and project are the key files that reference all of the others.

The JNLP file


/!\ Edit conflict - other version:


There is a template Cytoscape JNLP file cy1.jnlp in the cytoscape build directory. Excerpts of this file are shown here:

1. The header section


/!\ Edit conflict - your version:


There is a template Cytoscape JNLP file cy1.jnlp in the cytoscape build directory. Excerpts of this file are shown here:

1. The header section


/!\ End of edit conflict


<?xml version="1.0" encoding="utf-8"?>
<jnlp

---- /!\ '''Edit conflict - other version:''' ----
   codebase="http://chianti.ucsd.edu/kono/"
   href="cy1.jnlp">
  <information>
    <title>Cytoscape WebStart</title>
    <vendor>Cytoscape Collaboration</vendor>
    <homepage href="index.html"/>

---- /!\ '''Edit conflict - your version:''' ----
   codebase="http://chianti.ucsd.edu/kono/"
   href="cy1.jnlp">
  <information>
    <title>Cytoscape WebStart</title>
    <vendor>Cytoscape Collaboration</vendor>
    <homepage href="index.html"/>

---- /!\ '''End of edit conflict''' ----
    <offline-allowed/>
  </information>
  <security>
      <all-permissions/>
  </security>

---- /!\ '''Edit conflict - other version:''' ----

2. The resources section, where any jar files that are part of the application must be listed

  <resources>
    <j2se version="1.4+" max-heap-size="1024M"/>
<jar href="cytoscape.jar"/>
<jar href="lib/fing.jar"/>
<jar href="lib/coltginy.jar"/>
...
<jar href="plugins/browser.jar"/>
<jar href="plugins/control.jar"/>
...
<jar href="data.jar"/>

3. The Cytoscape command line arguments section

  <application-desc main-class="cytoscape.CyMain">
        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>
        <argument>-rp</argument>
        <argument>control.ControlPlugin</argument>
... 
  </application-desc>
</jnlp>


---- /!\ '''Edit conflict - your version:''' ----

2. The resources section, where any jar files that are part of the application must be listed

  <resources>
    <j2se version="1.4+" max-heap-size="1024M"/>
<jar href="cytoscape.jar"/>
<jar href="lib/fing.jar"/>
<jar href="lib/coltginy.jar"/>
...
<jar href="plugins/browser.jar"/>
<jar href="plugins/control.jar"/>
...
<jar href="data.jar"/>

3. The Cytoscape command line arguments section

  <application-desc main-class="cytoscape.CyMain">
        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>
        <argument>-rp</argument>
        <argument>control.ControlPlugin</argument>
... 
  </application-desc>
</jnlp>


---- /!\ '''End of edit conflict''' ----

The JNLP file is an xml file that tells Java Web Start what to do. This is the file you link to from your web page. The documentation above gives a detailed description of the various elements of this file. Here are some specific things to watch out for and some things specific to Cytoscape:

codebase and href. At the top of the JNLP file are two fields, codebase and href. The first points to a directory in which your files live, and the second is a pointer to the JNLP file itself. Thus, if you copy or move the JNLP file to a new location, you have to edit the file to point to the new location.

A very common mistake is copying the JNLP file and forgetting to change these fields. If you do this, it won't crash, it will just quietly load files from the directory specified in this field instead of the directory the JNLP file is in, and you'll get completely different files than what you were expecting.

Security: Cytoscape is currently written to require access to the local computer to read and save customization files and use system resources. Thus, you must put the "all-permissions" field in the security section or Cytoscape will crash. Note that the security manager of Java Web Start will go berserk over this and put up a dialog strongly advising the user not to run the code (because of the security risks). If you really need a secure environment, then don't run Cytoscape via Web Start.


/!\ Edit conflict - other version:


Resources: These fields point Web Start to the jar files it should load. There are three types of jar files needed in Cytoscape webstart: (1) cytoscape.jar and library jar files, (2) plugin jar files (this includes any of your own plugins that you want to use, and (3) data jar files. All of your data must be packed into one or more jar files. By default, the automated build process packs all data files into a data.jar file.


/!\ Edit conflict - your version:


Resources: These fields point Web Start to the jar files it should load. There are three types of jar files needed in Cytoscape webstart: (1) cytoscape.jar and library jar files, (2) plugin jar files (this includes any of your own plugins that you want to use, and (3) data jar files. All of your data must be packed into one or more jar files. By default, the automated build process packs all data files into a data.jar file.


/!\ End of edit conflict


Remember that, in all cases, a relative path to the resource may be used which is relative to the codebase value specified at the top of the JNLP file.


/!\ Edit conflict - other version:


Application arguments: Cytoscape requires command-line arguments to tell it what to do. The argument fields under the "application-desc" section provide these arguments. The most commonly-used arguments for webstart are -rp for specifying plugins, -g or -i for specifyig network data, and -e for specifying expression data.

If you you want to add a plugin to a Cytoscape webstart bundle, there are two modifications you will need to make to the .jnlp file.

1. In the resources section, add a jar declaration to include the plugin. For example:

<jar href="plugins/browser.jar"/>

2. In the application-desc section, add a runtime argument to specify the class that extends CytoscapePlugin. For example:

        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>

where browser.BrowserPlugin specifies the class that extends CytoscapePlugin.

If you have a data file to be loaded automatically in your Cytoscape webstart bundle, you will need to specify it in your .jnlp file with the jar:// syntax. For instance, if you want to load the network galFiltered.sif automatically, you should: 1. see that galFiltered.sif gets into your data.jar file (described below), 2. make sure your .jnlp file loads your data.jar file

<jar href="data.jar"/>

3. specify the galFiltered.sif with command line arguments, as follows:

<argument>-i</argument>
<argument>jar:://galFiltered.sif</argument>

Note that this works for networks and expression matrix files, but does not currently work for vizmap.props or cytoscape.props files. For other types of files, check for information on the cytoscape-discuss mailing list. }}}

== Building a webstart bundle ===

To build your own Cytoscape webstart bundle, you will need to do the following things: 1. Set up a key to sign your JAR files with (described in detail below) 2. Check out the Cytoscape source code from CVS, and go to the build directory (the one that contains the file build.xml). 3. Gather all the data files you will need to be loaded automatically (networks, expression matrix files, etc), and put them in the data subdirectory of the cytoscape build directory. 4. Put all the plugin jars you will need in the plugins subdirectory 5. Issue the command "ant webstart" 6. Copy all files and subdirectories from the build/webstart directory 7. Take the template file cy1.jnlp from the build/webstart directory, add jar declarations for any special plugins you have, modify the command line arguments for any plugins and data files you are using (discussed further below). 8. Put this whole bundle in a place where you can point to it with a URL 9. Modify the href and codebase lines of your .jnlp file accordingly. 10. Write a web page with a link that points to your JNLP file. 11. If you did everything correctly, and your browser is properly enabled, you should be able to click on the link and run Cytoscape. Alternatively, you can directly run your Java Web Start executable (usually called javaws) with the JNLP file as an argument. For example, on Linux: javaws cy.jnlp.


/!\ Edit conflict - your version:


Application arguments: Cytoscape requires command-line arguments to tell it what to do. The argument fields under the "application-desc" section provide these arguments. The most commonly-used arguments for webstart are -rp for specifying plugins, -g or -i for specifyig network data, and -e for specifying expression data.

If you you want to add a plugin to a Cytoscape webstart bundle, there are two modifications you will need to make to the .jnlp file.

1. In the resources section, add a jar declaration to include the plugin. For example:

<jar href="plugins/browser.jar"/>

2. In the application-desc section, add a runtime argument to specify the class that extends CytoscapePlugin. For example:

        <argument>-rp</argument>
        <argument>browser.BrowserPlugin</argument>

where browser.BrowserPlugin specifies the class that extends CytoscapePlugin.

If you have a data file to be loaded automatically in your Cytoscape webstart bundle, you will need to specify it in your .jnlp file with the jar:// syntax. For instance, if you want to load the network galFiltered.sif automatically, you should: 1. see that galFiltered.sif gets into your data.jar file (described below), 2. make sure your .jnlp file loads your data.jar file

<jar href="data.jar"/>

3. specify the galFiltered.sif with command line arguments, as follows:

<argument>-i</argument>
<argument>jar:://galFiltered.sif</argument>

Note that this works for networks and expression matrix files, but does not currently work for vizmap.props or cytoscape.props files. For other types of files, check for information on the cytoscape-discuss mailing list. }}}

== Building a webstart bundle ===

To build your own Cytoscape webstart bundle, you will need to do the following things: 1. Set up a key to sign your JAR files with (described in detail below) 2. Check out the Cytoscape source code from CVS, and go to the build directory (the one that contains the file build.xml). 3. Gather all the data files you will need to be loaded automatically (networks, expression matrix files, etc), and put them in the data subdirectory of the cytoscape build directory. 4. Put all the plugin jars you will need in the plugins subdirectory 5. Issue the command "ant webstart" 6. Copy all files and subdirectories from the build/webstart directory 7. Take the template file cy1.jnlp from the build/webstart directory, add jar declarations for any special plugins you have, modify the command line arguments for any plugins and data files you are using (discussed further below). 8. Put this whole bundle in a place where you can point to it with a URL 9. Modify the href and codebase lines of your .jnlp file accordingly. 10. Write a web page with a link that points to your JNLP file. 11. If you did everything correctly, and your browser is properly enabled, you should be able to click on the link and run Cytoscape. Alternatively, you can directly run your Java Web Start executable (usually called javaws) with the JNLP file as an argument. For example, on Linux: javaws cy.jnlp.


/!\ End of edit conflict


Signing your jar files


/!\ Edit conflict - other version:


Because Cytoscape runs with all permissions, you *must* sign all of your jar files, or Web Start will refuse to run the program. In addition, all of the jar files must be signed using the same key, and every jar can only be signed once. This can present problems if you want to take a Cytoscape webstart bundle originally built by someone else and change a few jar files (such as data.jar).


/!\ Edit conflict - your version:


Because Cytoscape runs with all permissions, you *must* sign all of your jar files, or Web Start will refuse to run the program. In addition, all of the jar files must be signed using the same key, and every jar can only be signed once. This can present problems if you want to take a Cytoscape webstart bundle originally built by someone else and change a few jar files (such as data.jar).


/!\ End of edit conflict


To sign a jar file you use the keytool and jarsigner applications provided with the Java SDK. In ISB's Linux environment, these tools live in /tools/java/sdk/bin. Online documentation for these tools is at [http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/jarsigner.html]


/!\ Edit conflict - other version:


First, you have to generate an encryption key, which will live in a personal keystore. You will need to do this only once. You do this with


/!\ Edit conflict - your version:


First, you have to generate an encryption key, which will live in a personal keystore. You will need to do this only once. You do this with


/!\ End of edit conflict


keytool -genkey keyName


/!\ Edit conflict - other version:


You will be prompted for a password for this key. In addition, if this is the first key you've ever made, you will be prompted for some personal information and a password for your keystore; by default your encryption keys are stored in the file ".keystore" in your home directory. To make this easiest of yourself, generate a key with the command

keytool -genkey -alias cytoscape -keypass secret

and enter "secret" for the password. If you do this, the Cytoscape build procedure will sign your jars for you automatically. If instead you want to sign your jars manually, you can do so with the jarsigner command.


/!\ Edit conflict - your version:


You will be prompted for a password for this key. In addition, if this is the first key you've ever made, you will be prompted for some personal information and a password for your keystore; by default your encryption keys are stored in the file ".keystore" in your home directory. To make this easiest of yourself, generate a key with the command

keytool -genkey -alias cytoscape -keypass secret

and enter "secret" for the password. If you do this, the Cytoscape build procedure will sign your jars for you automatically. If instead you want to sign your jars manually, you can do so with the jarsigner command.


/!\ End of edit conflict


jarsigner -keystore /home/me/.keystore -storepass keystorePasswd -keypass keyPasswd data.jar keyName

Obviously, replace "/home/me" with the path to your home directory, replace the password arguments with your actual passwords, use the same key name as you did when creating the key, and change the name of the jar file to whatever you want to sign.


/!\ Edit conflict - other version:



/!\ Edit conflict - your version:



/!\ End of edit conflict


Troubleshooting

If it doesn't work the first time, the error messages you get may or may not be helpful. Go through the checklist carefully to make sure you did every step right.


/!\ Edit conflict - other version:


A surprising number of errors are caused by spelling a name wrong, either a control key, the name of a file, or a parameter value. Often such errors don't create a visible error message, but make things unexpectedly not work. For example, if you misspell the name of a data file in data.jar, you will quietly see no data. Triple check all of your spelling.


/!\ Edit conflict - your version:


A surprising number of errors are caused by spelling a name wrong, either a control key, the name of a file, or a parameter value. Often such errors don't create a visible error message, but make things unexpectedly not work. For example, if you misspell the name of a data file in data.jar, you will quietly see no data. Triple check all of your spelling.


/!\ End of edit conflict


Here are some other common mistakes:

  • If the web start can't even get started, make sure the syntax of your JNLP file is perfect. Any tiny mistake will make it not work.
  • Make sure your JNLP file has the right codebase and href fields.


/!\ Edit conflict - other version:


  • Make sure your JNLP file references the right jar files.
  • If you have added some plugins, make sure you have specified them with the --rp switch, specifying the class that extends CytoscapePlugins. If you specify the wrong class, you will get an undecipherable null pointer error message.

  • Make sure you put all the files in the data.jar that were supposed to be there. Use "jar tf data.jar" to see the contents of the jar.
  • If you are a glutton for punishment and are not using the automated build procedure, make sure that all jar files (including data.jar) are signed with the same key.

Note that Cytoscape will read the user's personal configuration files, if available. If the user has no personal configuration files available, then Cytoscape will use default configuration data. This may cause the application to behave differently for different users.


/!\ Edit conflict - your version:


  • Make sure your JNLP file references the right jar files.
  • If you have added some plugins, make sure you have specified them with the --rp switch, specifying the class that extends CytoscapePlugins. If you specify the wrong class, you will get an undecipherable null pointer error message.

  • Make sure you put all the files in the data.jar that were supposed to be there. Use "jar tf data.jar" to see the contents of the jar.
  • If you are a glutton for punishment and are not using the automated build procedure, make sure that all jar files (including data.jar) are signed with the same key.

Note that Cytoscape will read the user's personal configuration files, if available. If the user has no personal configuration files available, then Cytoscape will use default configuration data. This may cause the application to behave differently for different users.


/!\ End of edit conflict


Bug report: we've identified an obscure bug associated with JPEG images. It appears that when certain JPEGs are put into a jar that is then signed, an application that attempts to create an image from the archived JPEG file triggers a crash of the Linux Java Virtual Machine. For this reason, we suggest that you don't use JPEG images in your Web Start application. GIFs or PNGs don't appear to have this problem.

Good luck building your Cytoscape Web Start application!

Cytoscape_via_Java_Web_Start (last edited 2009-02-12 01:03:15 by localhost)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux