One of the frequently posted questions in this forum is “How do I make my program an ‘executable’ (EXE) for sharing with others?” The help files provide all the information you need in the topic “Using the Runtime Engine.”
There will be no code in this tutorial, merely step by step instructions, tips that work well for me, and a few screen shots. I prefer WinRAR to bundle executable packages of my programs, but you do not have to purchase anything to create a stand-alone program created with JB.
The first thing you should do is create a folder for your project. The folder can be anywhere on your hard drive, but I usually create it within the JB folder since that is where I will be working on the BAS file while writing the code; it is also where I will save the data files, images, sounds, or other files required by the program.
Recently I was working on a program to track my weight (this is sometimes a problem for senior citizens with diabetes). Since I have a friend who also has diabetes, I decided to send him a copy of the program.
If you are sharing with a friend who uses JB, the only files you need to send are the program file (BAS) and data, images, sounds, etc., for your program. If your user does not have JB, you can still share your program by creating an EXE file.
After the program was complete and performing to my satisfaction, I began to create the EXE file to send to my friend. Use the following steps to create an EXE file.
1. From the Just Basic program editor (IDE), click on RUN and choose “Create TKN file.” JB will create a TKN file from the BAS file and save it to your current folder.
2. Copy (don’t move) the files shown below to your project folder. All nine files must be contained within your project folder.
3. Rename jbrun101.exe to the same name as your TKN file, in this example, weight.exe. My project folder now looks like this. NOTICE there is no BAS file needed in the in the project folder, and jbrun101.exe has been renamed as weight.exe.
4.If you are not going to use any compression or installer utility, you are done. Because you can’t send a folder by email, simply tell your user to create a folder with the name of your program anywhere on his hard drive. Email or send by floppy, all the files above which need to be placed inside the folder. Double-clicking on myProg.exe will run your program. Your user can also right-click on myProg.exe and choose “Send to Desktop as Shortcut,” to create a shortcut to run the program.
To create a professional looking installation package, some users purchase an installation utility. There are several you can download and try before you buy, such as Install Station, Tarma Installer, Inno Setup, and others. Install packages will usually cost you $20 to $30 for the full version and have many optional features. I have tried all the above and found they do not offer much in the way of file compression. Your completed EXE file will usually be more than 2MB in file size before adding the program and supporting files, a real disadvantage if your user has a slow dial-up connection. I will not describe using any of these installer packages since each has different methods and procedures. If you purchase one, spend a lot of time with the application help files.
Commercial software developers use a compression utility to create a much smaller file for downloading. Examples are WinZip, BitZipper, and WinRAR. There are many more, but these appear to be the most popular. Of these, my favorite is WinRAR, available from www.win-rar.com for $29, which includes free upgrades for life.
See the help files with your compression utility to learn how to create a ZIP or EXE file. With WinZip or BitZipper, a ZIP file is created simply by right-clicking on your program folder, then choosing “Add to Zip” or “Create Archive.” You must create a ZIP file before it can be converted to an EXE file.
If you are using WinRAR, you can skip the first step of creating a ZIP file and go directly to creating an EXE file, called SFX in WinRAR. Of the compression utilities I’ve tried, WinRAR offers the most features and best compression for the money. When creating EXE files, it can also create a desktop icon for your friends who may be digitally challenged by computers. WinRAR is not an install utility, but it will do a very nice and professional looking job. Because of the extra features when using WinRAR, the steps to create an EXE file are a little more detailed.
1. Right-click on the program folder and choose “Add to Archive.” In the next window, check SFX archive, then click the Advanced tab.
2. Click on SFX options.
3. In path to extract, type C:\Program Files
4. Click on the License tab and ender any licensing notice. You can omit this step.
5. Click on the Advanced tab (part of the SFX Options) and choose Add shortcut.
6. Leave the Desktop radio button checked and type the full path to your EXE file, in this example, C:\Program Files/myWeight/weight.exe Leave the description blank but enter the name for this program icon on the desktop.
7. Click OK to close Add Shortcut.
8. Click OK to close Advanced SFX options.
9. Click OK to close Archive name and parameters. WinRAR creates your EXE automatically.
The TKN and TXT files for weight.exe total less than 5 KB. The finished executable for this example is 1.07 MB. When run, the JB icon will be added to the user’s desktop and look like this:
A program installed in the above manner WILL NOT make any changes to the user’s registry. The program WILL NOT appear in the Add/Remove utility of the Windows control panel. If you desire to delete this program, delete the shortcut from the desktop; then find C:\Program Files/myWeight and delete the program folder
Many thanks to those old timers who shared these tips with me when I first began using Just Basic. Now it’s my turn to share them with you.