Using Java Web Start in NetBeans 1. When you have fully ...

66 downloads 36 Views 282KB Size Report
Using Java Web Start in NetBeans. 1. When you have fully completed your application, open “Project Properties” and select “Application – Web Start” to get the ...
Using Java Web Start in NetBeans 

2  3  4  1 

5  6 

  1. 2. 3. 4.

When you have fully completed your application, open “Project Properties” and select “Application – Web Start” to get the screen above.  Select the checkbox for “Enable Web Start”.  In the Codebase drop‐down menu, select “User defined (e.g. HTTP deployment)”.  For the Codebase Preview textfield, enter the URL of where the application will be placed on the web.  In most cases, the application will be  on the www2.onu.edu server.  It is strongly suggested that, for each application you want to place on the web, you create a separate  directory.  In this example, the web page that references the application is the index.html file in the http://www2.onu.edu/~jestell/java  directory; I will create a Farkle subdirectory for holding the appropriate files of the application.  5. Select the checkbox for “Self‐signed”.  6. Select the radio button for “Application descriptor”. 

7. At this point, build and compile your project.  Open the “Files” view of the project and  look within the “dist” folder – you should see the file “launch.jnlp”.   This is the file used  to start a Java Web Start application.  8. We are now ready to transfer files to the web site host (in this case, “austin” or  www2.onu.edu).  These steps assume that you have a working knowledge of FTP and  HTML.  9. Use WinSCP (available through Luminis) to upload all of the files contained in your  project’s “dist” folder into an appropriately named subdirectory.  In this example, the files  highlighted within the red box at right were uploaded into the aforementioned “Farkle”  subdirectory.  10. Edit the web page that references your applications such that it now includes the  following relative pathname:  Play Farkle!  

The key points here are as follows:  •

The file that one accesses via a web link is automatically named “launch.jnlp” by  NetBeans.  • By keeping separate folders for each application, you don’t have to mess with  renaming any of these files.  11. Use WinSCP to upload your revised web page.  12. Go to your web site on Austin and test your links to see that they work.    NOTE: If you need to make any modifications to your application, you will need to turn off Java Web Start by deselecting the checkbox for  “Enable Web Start” prior to running your application locally.  Once the modifications have been made and tested, reselect the checkbox, rebuild  the application, and upload the files in the “dist” folder to place the new version up on the web.         

HTML Notes:  You’ll need a file called “index.html” for accessing your applications.  The following consists of simple, bare‐bones HTML  code for use with Farkle – use Wordpad to type this in and save it somewhere on your computer:  My Java Applications

Farkle

    WinSCP Notes:  When you initially use WinSCP, you’ll need to set up a session for communicating with the appropriate host.  Make sure  that your session for connecting to Austin appears as follows (with the appropriate user name): 

   

 

Once you’re logged in, you’ll see something similar to the following: 

  The left side contains the folders and files of the computer that you’re on; the right side is where you’re uploading to.     • • • • •

On the right side, double‐click on “www” to open that folder, as all web pages must be contained within that folder.    On the left side, navigate to where your Farkle application project is located.    Copy the entire contents of the “dist” folder for Farkle by dragging and dropping it to the right‐hand side; a dialog  box will then appear – click on the “Copy” button.    On the right side, right‐click on the just‐copied “dist” folder, then select “Rename” and give the folder the name  “Farkle”.   On the left side, navigate to where your index.html file is located, and copy it into the “www” folder on the left side. 

You should now be able to use a web browser to run your application.  Use as your URL:  http://www2.onu.edu/~j‐student  where j‐student  is replaced with your Luminis login name.  Use this URL with a web browser to access your index.html  file, then click on the link to launch your program.