Turning your project into an Executable File

Task 1: the runtime image

      Creating the runtime image is necessary to clean out your VisualWorks image of all the unnecessary packages and methods that are not used or called by your actual application. This is a necessary step to really cut down on the size of your executable file.

*** Note that in Task 2 you will actually create the executable file from this runtime image because this step only produces an image that will run the application if the machine has VisualWorks installed, and that is clearly not the goal we are trying to achieve. ***

----------------------------------------------------------------------------------------------

      The first step in creating your runtime image is to close out of ALL VisualWorks windows EXCEPT the Transcript window itself. You should not have any other windows open. (Other windows include the Store, System Browser or workspaces) Below is an image of the only window that should be open:



      Now in order to proceed with creating your runtime image you will need to load and unload some packages that may or may not be installed to assist you with stripping your current image.

      From the Transcript window you will open the Parcel Manager by going to System->Parcel Manager or simply F3.



      Now inside the Parcel Manager you need to unload the UIPainter parcel which allowed you to create any GUI windows for your application. To locate the UIPainter, click on Essentials under the Suggestions tab. Once you have located the package you can unload its contents from your image by right clicking on it and selecting Unload.



      If prompted by the unloading process by the following message: ‘Remove empty categories and purge Undeclared?’ It will give you the options of 'Yes' or 'No', you will select Yes here in order to finish unloading the unwanted parcel.



      Once the UIPainter parcel has successfully been unloaded you will then need to load in the RuntimePackager parcel. This package will be the largest helper in creating your runtime image. From the Parcel Manager, under Essentials select RuntimePackager and then right click and select Load.



      Once the RuntimePackager parcel has finished loading its contents into your image you are finished with the Parcel Manager and it is key to close out of the Parcel Manager window.

----------------------------------------------------------------------------------------------

      Now, back in the Transcript you have the ability to select the RuntimePackager tool to help strip your current image of unnecessary contents. In order to do this you will go to Tools->Runtime Packager in the Transcript window.



Upon selecting the Runtime Packager tool, the following window should open for you to use:



      This Runtime Packager will allow you to strip down your current image and retain only what is absolutely necessary to run your application. The following will consist of several 'Next >>' and 'Do this step' instructions.

----------------------------------------------------------------------------------------------

      So from the Overview you first want to select Next >> and this will take you to Clean Up Image which will clean out a lot of unnecessary packages and methods. You now want to select Do this step. The following dialog box should appear:



      Choose Yes, which should then prompt an Undeclared Items window. This is a window you may disregard in creating your runtime image so you may close it and proceed.



----------------------------------------------------------------------------------------------

      Now that this step is complete you will select Next >> and this takes you to the Set Options step. This step will allow you to select the class of your application that will start and the method from which the future executable will call on your opening class to start running your application. Select Do this step.



      You will now be prompted by a Runtime Packager Common Options window. You will only alter the three fields found in the opening Basics tab. For your runtime image you want to specify the Startup Class (the main class of the application that will spawn any other windows pertaining to its execution), the corresponding Startup Method (the actually method that initiates the startup class) as well as the Runtime Image Path Name which is ‘runtime’ by default. Note that you may keep the default name as ‘runtime’ now and change it later on.



      Once you have finished filling out the mentioned fields you will select OK and continue on in creating your runtime image.

----------------------------------------------------------------------------------------------

      Once that step has been completed you will select Next >> which will allow you to specify classes and methods to keep for your application.



      For this step, you may click Next >> again and essentially skip this manual process of selecting the right classes and methods to keep or delete because the RuntimePackager itself finds most of the classes and methods for your application automatically. If in the event that it misses some you can easily select '<< Previous' and return to this step and find them all yourself.

However, if you were to select Do this step you would be prompted by the following window:



      This window shows that you may keep and delete various classes or methods from your applications package in order to strip down unnecessary classes and methods such as DomainTests which are insignificant and unnecessary in regards to actually running your final application. Once you have selected all of the necessary classes and methods for your application select OK and then click Next >>.

----------------------------------------------------------------------------------------------

      You are now at the step which will help scan for unreferenced items within your image. Select Do this step.

      You will initially be prompted by a Progress Notifier which simply displays the progress of the current step:



      Once that has completed, the Runtime Packager window will display results and you can then select Next >>.



----------------------------------------------------------------------------------------------

      The next two steps, Review kept classes and methods and Save runtime loadable parcels are steps that are advantageous if you to either ensure you runtime image has the necessary classes and methods or if you wish to supply parcels that load at runtime and that are not actually loaded into the runtime image. For this tutorials purposes we will skip these two steps, so you may select Next >>, Next >>. This will now bring you to actually testing your application.



----------------------------------------------------------------------------------------------

      This is a step that you may skip if you are sure that you have included all the necessary classes and methods, but it is always a safe idea to test your application here before you have created the runtime image. Otherwise, if you finish and you later find out there are errors within your application, we must then create a completely new runtime image. If you wish to test your application select Do this step and you will be prompted by the following Runtime Application Tester window:



      From the Runtime Application Tester window you will select Begin Test which will then launch your application after installing various wrappers to run the application as a stand alone.



Once you are finished testing your application you may then select End Test.



      After you have finished testing your application, the Dynamic References may be blank or consist of classes and methods. If the list is empty you are nearly finished in creating your runtime image. Select OK and continue on.

      However, if there is a list of classes or methods, these classes/methods are used by the application but were not found in the constructed runtime image and you will need to add them before you are finished. By clicking OK you will be prompted to either accept or reject the dynamic references.


      You will choose No and click << Previous until you reach the Specify classes and methods to keep step. You will now select Do this step. You may be able to find the necessary classes simply by scrolling through the package list, but it is much easier to find their locations by selecting Packages/Bundles->Find Package … or simply Shift+Ctrl+P.



      After selecting this option you will be prompted by a dialog which will assist you in your search for the Dynamic References.



      Once you have found all of the classes or methods you needed, you should select OK and then proceed to the Scan for unreferenced items step you completed earlier. You will want to re-do this step to ensure there are no unreferenced items within your specified classes and ensure the RuntimePackager took your recent changes.

----------------------------------------------------------------------------------------------

      After completing this step you will continue selecting Next >> until you are able to finish testing your application to ensure there are no more Dynamic Refernces. After this has been completed you may finish creating our runtime image.

      Upon completing your testing of your application and you have no Dynamic References you may then select OK and accept the Dynamic References by clicking Yes.

----------------------------------------------------------------------------------------------

      By clicking Next >> you reach the Runtime Parameters step which offers advanced options which this tutorial will skip because they are not important for your particular application. Now you may go to the next step by selecting Next >>.



----------------------------------------------------------------------------------------------

      You have now reached the final step which will create your stripped runtime image. Select Do this step and then click Yes when prompted by the following dialog:



Another dialog will be spawned and you will select Yes again for this window.



      Be patient in the following minutes as VisualWorks strips your current image of all unnecessary content and creates your new runtime image. Another Progress Notifier window will appear and display the current progress in creating your runtime image.



      Once VisualWorks is finished creating your runtime image it will open and close a dialog box displaying information of its successful creation and finally close everything including your original Transcript window. To be certain your runtime image was created, if you go into your image folder within your VisualWorks installation directory, sure enough it is there with your original image.



      Now you are finished creating your runtime image and can test your application by double clicking your runtime image which should then start your application. However, you still need VisualWorks installed in order to run your application from this runtime image, which may be okay for the developer, but not for the end user. In order to create an executable from your new runtime image to distribute to users, see Task 2.

cs2340 - fall 2008 - kylejgabriel