Share Your Finished Program by Creating an EXE File

Programming Tools, Tips, and Tutorials.
Welopez
Posts: 56
Joined: Fri Jan 07, 2005 11:16 pm
Location: Currently living in Riverside, CA

Share Your Finished Program by Creating an EXE File

Post by Welopez »

Nothing fancy here, no code, and no Worbles; just a web page plain and simple. Step by step instructions with screen-shots, to create a "stand-alone" EXE file of your new Just Basic program. You do not have to buy anything to create and share your EXE files, but a compression utility such as WinZip, BitZipper or WinRAR is recommended.

How to create TKN and EXE files of your program. How and where to save your supporting files, such as TXT, DAT, BMP, WAV, and MIDI. Don't forget those SLL and DLL files, and jbrun100.exe for persons who do not have Just Basic on their computer. A stand-alone EXE will allow your friends to run your newest Whiz-Bang program. EXE files can be shared over the Internet, saved on CD or floppy disk (providing there is sufficient room), and are a fun way to show others your skills as a 'bonafide techno-geek' creating programs for Windows.

I prefer and recommend WinRAR, and will walk you through creating an EXE file using WinRAR, complete with a desktop icon to run your program when you double-click the icon. WinZip and BitZipper are briefly mentioned.

Download createEXE.zip. Save to your My Documents folder and unzip the file. Double-click on createEXE.mht to display the web page in your default browser. (MHT files are single-file archives of individual files used to create a web page.)

As always, you should scan any downloaded files with your anti-virus program. I know I would not send a virus to anyone, either by accident or design, but some persons are not as 'friendly' as I am. Play it safe and always scan downloaded files before unzipping or running. It's a good habit to cultivate.
You do not have the required permissions to view the files attached to this post.
honwahp
Posts: 5
Joined: Thu Oct 13, 2005 6:05 pm
Location: Hong Kong, China

error encountered

Post by honwahp »

Hi , I have read the instructions in the downloaded file carefully and have followed step by step to create the exe file. I have created a folder, copied the dll and sll files, renamed the jbrun101.exe, and created the tkn file. However, when I tried to execute the program, there is an error message which said "Runtime Error: 0 is outside of collection bounds". Can you help me with this because I really don't know what went wrong!
Welopez
Posts: 56
Joined: Fri Jan 07, 2005 11:16 pm
Location: Currently living in Riverside, CA

Post by Welopez »

I have created a folder, copied the dll and sll files, renamed the jbrun101.exe, and created the tkn file.
It sounds as if you have done everything properly, but from your statement above, did you create the TKN file first? You have to do that first so the runtime engine knows which file to point to.

I've used the above procedure dozens of times, and so have many others wishing to create an EXE file, and this is the first time I've been advised of a problem with it.

Good luck!
honwahp
Posts: 5
Joined: Thu Oct 13, 2005 6:05 pm
Location: Hong Kong, China

error encountered

Post by honwahp »

Hi I am grateful for the speedy reply but I am still unable to make the standalone exe run. I did create the tkn file first. I have done it six or seven times now, using different folder names(the tkn and exe files have the same name), but I am still in vain. I even did it on another computer (my notebook), but I get the same error message.
It really is exciting to be able to write a small program of my own and help is truly appreciated.
JanetTerra
Site Admin
Posts: 117
Joined: Wed Nov 24, 2004 2:49 am

Post by JanetTerra »

When troubleshooting, it's best to start at the beginning. First, write a simple .bas file

Code: Select all

Print "Hello world."
Input "";z$
End
will do.
Now, tokenize it the way you've done. From the Just BASIC Run menu, choose RUN *.TKN File. Does it run? Yes? So far, so good.
Now, making sure all the required dll's and sll's are in your folder, including the renamed RUN file, double click the renamed RUN file. (Remember, you're still working with the simple .bas file above). Does it run? If not, you're doing something wrong. Check all your support files. Are they all there? Have you made a copy of JBRun101 and not JBasic101? (I think I changed the names in my folder to reflect the v1.01. If your names are different, don't worry. Just be sure you are copying and renaming the RUN program.) When you have all the required files in this folder and your simple bas file runs, move your problem .tkn and RUN files into the folder. Double click the renamed run file of your problem file. Does it run now?
If your problem file still doesn't run, then the problem lies in either your coding (trying to access a handle that doesn't exist, for example) or you have other files (.bmp, .txt, etc.) that you are trying to access that you forgot to include in the folder.
If you are still having problems, run a copy of the bas file of the problem tkn file (you saved your bas file, right?) from within this folder. Do you get an error? Run the bas file in debug mode. What does the highlighted line say?
Hopefully these ideas will help. It almost always comes down to a support file that has been inadvertently omitted from the folder.
Janet
honwahp
Posts: 5
Joined: Thu Oct 13, 2005 6:05 pm
Location: Hong Kong, China

Post by honwahp »

Hi thanks for the reply. I made the "helloworld" .bas file and saved it to a folder. I then clicked Run, and select Make *.tkn file. I saved the .tkn file to the same folder. But when I clicked "Run" and selected "Run *.tkn file",after I selected the helloworld.tkn file from the Dialog Box, there is an error message which says "Runtime error:index: 0 is outside of collection bounds". I was unable to run the .tkn file although I can make it.
I wonder what I should do.
honwahp
Posts: 5
Joined: Thu Oct 13, 2005 6:05 pm
Location: Hong Kong, China

Post by honwahp »

By the way, I downloaded a Liberty Basic file called LBCanDo. I saved it to a folder and unzipped it. When I clicked on the icon (a torch) that should run the program, I encountered the same error message as I did on my previous posts.
The error message is "Runtime error:index:0 is out of collection bounds(see error.log for more information)"
JanetTerra
Site Admin
Posts: 117
Joined: Wed Nov 24, 2004 2:49 am

Post by JanetTerra »

Could you upload both the .bas version and the .tkn version of your files to the Broken Code section here? One of us will download and test it. Thanks. You don't need to include any of the other files (renamed run.exe, dll's, sll's, etc.). Just the .bas and .tkn will do.
Janet
honwahp
Posts: 5
Joined: Thu Oct 13, 2005 6:05 pm
Location: Hong Kong, China

file uploaded

Post by honwahp »

Hi please see my post at the Broken Code Section. Thanks.
david smith
Posts: 3
Joined: Fri Feb 10, 2006 3:24 pm

Post by david smith »

I`ve just read these comments by Honwahp and I`ve noticed something I don`t understand. Maybe someone can help me.


When I tried to create a TKN file using the method in the Helpfile in Just Basic I kept getting error log messages, however when I used exactly the same method in Liberty Basic it worked.

After a while trying to figure out why this was so I noticed the Setup button at the top of the editor and noticed that the Preference set up between LB and JB was different ( in particular the ticked/unticked Reload File on Activate button ). However, after much experimentation this doesn`t seem to be relevant.

In conclusion, the only way I can create a TKN file in JB is to create it in LB then create the same named file in JB. Maybe this is normal procedure. I don`t know. Still, it`s better than not being able to create a TKN file at all


It`s just that I get the feeling that I`m probably missing some really simple point here and I`d be grateful if someone could point out what it is.

Thanks.

David Smith.
John Davidson
Site Admin
Posts: 128
Joined: Sat Nov 13, 2004 8:36 am
Location: Vashon Wa

Post by John Davidson »

This sounds like a association problem.
If, on your system, you have associated Tkn files to Liberty BASIC's runtime engine, and click on a Just BASIC Tkn in Explorer, you will error out.

Your JB Tkns can be ran through the JB editor but if you want to access them through Explorer you will need to click on the renamed Exe.

John
John Davidson
e-me: johnshomeport@yahoo.com
My JB Page: http://john.jbusers.com/
Did ya Libby yet? http://lblibby.com/
david smith
Posts: 3
Joined: Fri Feb 10, 2006 3:24 pm

Post by david smith »

Thanks for that reply.

I`ll try out some other ideas when I go to another internet cafe and I`ll let you know how I get on.


David Smith.
Welopez
Posts: 56
Joined: Fri Jan 07, 2005 11:16 pm
Location: Currently living in Riverside, CA

Creating Stand Alone Programs

Post by Welopez »

Hi! Thanks to all the others who have jumped in and assisted some of our users. Owing to family difficulties, I have not visited this post in nearly a year.... :oops:

Most of the problems described appear to result from PEBCAK. If any paths are included in your program, make certain they are not hard coded to a location on your user's computer, unless you know the file location. Normal procedure is to create a project folder for your program, save any files being used (.DAT, .TXT, .WAV, .MID, .BMP, etc) to that folder, which will be the "default directory" for your completed program.

Create the .TKN file while your program is displayed in the code editor by clicking on RUN > Make .TKN file. COPY, don't move, jbrun101.exe and all required DLL/SLL files to your project folder. Now rename jbrun101.exe to the exact name of your .TKN file. After the runtime engine has been renamed, you can double-click on your .EXE file and it should run. "If at first you don't succeed, try and try again!"

When your program is performing to your satisfaction, you may delete the .BAS file from your program folder, unless you want to share it with another coder, but another JB coder does not need the runtime engine and SLL/DLL files. Delete any error log which may be in your folder, it is of no use to another user.

Finally, make a ZIP of your project folder. This will insure ALL files are contained in the same folder as your runtime engine and .TKN. It also keeps them together when unzipped, so they will not be saved to the user's hardrive in alphabetical order and many locations.

I apologize if anyone has had difficulty creating an .EXE using the tips I've provided, but these procedures have worked for hundreds of coders and should work for you.
david smith
Posts: 3
Joined: Fri Feb 10, 2006 3:24 pm

Post by david smith »

It`s been a while since I looked at this forum because I got so frustrated with this 'creating an exe' problem. No matter how I tried I just couldn`t seem to do this. Then for some reason I could do this and i was elated for a while and wrote many progams then my luck seemed to run out and I was back to the same old problem. Actually creating an exe wasn`t the problem, it was running the tkn file. I would always get some error message.
However, today I realized what I was doing wrong. I`m no technical expert but I reckoned that what all these error messages are saying basically is that 'the tkn file can`t be found'.
Now, today I realized that if you have a bitmap loaded into your program you have to be very specific in your code to tell the system where to find the bitmap so it will run and if this bitmap, bas and tkn file are in the same place then the tkn file will also run (because you are also telling the system where to find the tkn file). So if there is anyone else having the same problem as me then I`d like to say this... If theres no bitmap in your program then the tkn may not run but if there is a bitmap included it will run.l. I hope this is useful to someone.