Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Sridhar Sri
RE: Unable to run the exe created by Ocra [ reply ]  
2009-09-23 21:31
Stefano,
I solved it by building my exe by using this:

ocra MyMain.rb MyClass1.rb MyClass2.rb

Also, I used the $LOAD_PATH.unshift... before requiring the files.
These two together seem to have solved my issue. I can now run the .exe from anywhere.

Thanks!!!

By: stefano fusillo
RE: Unable to run the exe created by Ocra [ reply ]  
2009-09-23 20:58
If you put
-->require MyClass1.rb
withouta path in front the exe will search it at its same level (the same path where you put the exe). So when you run the exe in the same directory where your main is and where is MyClass1.rb all works fine. You would get the same copying MyClass1.rb always at the same level of your exe.
In order to avoid this process and get your exe working you must copy MyClass1.rb in the same path of the other classes (the path where the interpeter searches as default root all the required .rb).

By: Sridhar Sri
RE: Unable to run the exe created by Ocra [ reply ]  
2009-09-23 20:29
Sorry, I was not clear in my previous example. All the .rb files are at the same level as the main script.

I can generate the exe and run it successfuly. But if I put this .exe file in any other directory, thats when it barks about not finding those .rb files.

It is almost as if it has hardcoded the paths in the package. I am only using the
require 'MyClass1.rb'
require 'MyClass2.rb'
I am not hardcoding any paths, so not sure how that happens.
Thanks.



By: stefano fusillo
RE: Unable to run the exe created by Ocra [ reply ]  
2009-09-23 20:01
This is because the exe searches the classes you created at the same level of the main script.If you put your class in the same path of the others you'll get your exe working because that is the default path where ruby searches the required files

By: Sridhar Sri
RE: Unable to run the exe created by Ocra [ reply ]  
2009-09-23 18:25
A little about this script.

MyScrip.rb calls classes in 2 different files located in the same drectory. So the structure is:

-->MyFolder--> MyScript.rb
MyClass1.rb
MyClass2.rb

I do use the require "rubygems" at the top of all the requires
I am making the exe using
ocra MyScript.rb and can see it packaged correctly. I just cannot run it anywhere outside this folder (which kind of defeats the purpose of packaging it).

Thanks.

By: Sridhar Sri
Unable to run the exe created by Ocra [ reply ]  
2009-09-23 18:19
Hello,
I am able to build the exe using ocra, but unable to run it as I get the following error. Not sure why it is looking for the physical location of the .rb files. Appreciate any help!!

C:/WINDOWS/Temp/ocr371F.tmp/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- MyScript.rb