# Make .rb with gnome to .exe in window ploblem?

**URL:** <https://www.ruby-forum.com/t/make-rb-with-gnome-to-exe-in-window-ploblem/136186>\
**Category:** Ruby-Gnome 2\
**Created:** [April 29, 2008, 5:53pm UTC](https://www.ruby-forum.com/t/make-rb-with-gnome-to-exe-in-window-ploblem/136186 "2008-04-29T17:53:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [April 29, 2008, 5:53pm UTC](https://www.ruby-forum.com/t/make-rb-with-gnome-to-exe-in-window-ploblem/136186/1 "2008-04-29T17:53:17Z")

</div>

I use ruby 1.8.6 and ruby-gnome2 I can run by Scite with it work  
normally. But when I make to .exe by follow this

* * *

== rubyscript2exe on Windows, solution 2

Another solution is to copy all the needed files inside the temporary  
directory created by rubyscript2exe, each time the application starts.  
You put all the needed GTK files and folders in a subfolder of your  
source code, and copy those files in the rubyscript2exe directory at  
startup. That way, you don’t have to touch your ruby installation or  
make it possible to run your ruby program from any folder.

Let’s create a “run\_dep” folder under the folder where you have the  
source code of your application.  
In that folder, copy the etc/, lib/ and share/ from your GTK  
installation. The GTK installation is in c:\gtk or C:\Program  
Files\Common Files\GTK\2.0. You can safely remove the “doc” and  
“gtk-doc” subfolders of the “share”, to save some space.  
In share\locale, you can remove the locales you don’t need if you want,  
to save more space (locales take ~20Mb). You can remove all the contents  
of the share\locale folder if you want, the english/US is always  
shipped.  
For me, I could also remove \*.lib in lib (10Mb), and lib\locale (15Mb).

Then, add the following lines at the start of your main .rb file:

require ‘rubyscript2exe’  
require ‘fileutils’  
require ‘pathname’

p0 = Pathname.new(RUBYSCRIPT2EXE.appdir)  
root\_runtime = p0.parent.to\_s  
begin  
FileUtils.cp\_r(‘run\_dep/.’, root\_runtime)  
rescue  
end

Those lines copy all the files & folders inside the “run\_dep” folder to  
the folder where rubyscript2exe will extract your application. The  
begin/rescue is needed because that fails when you run your application  
the first time in rubyscript2exe, to create the .exe.

Regenerate your application, and run the exe… it should work now!

## In the end, to ship my application I need 6Mb exe and 1.26Mb “run\_dep”, plus the glade files. And it seems no GTK installation is needed on the target computer!

```
If someone thinks it's a useful addtion to the Hiki, could someone

```

add it (or give me a password)? Thanks!

emmanuel

* * *

I can’t run .exe file!!! please see my picture for problem :’(

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [April 29, 2008, 7:13pm UTC](https://www.ruby-forum.com/t/make-rb-with-gnome-to-exe-in-window-ploblem/136186/2 "2008-04-29T19:13:45Z")

</div>

Hi:

> startup. That way, you don’t have to touch your ruby installation or  
> of the share\locale folder if you want, the english/US is always  
> root\_runtime = p0.parent.to\_s  
> begin  
> FileUtils.cp\_r(‘run\_dep/.’, root\_runtime)  
> rescue  
> end

For me itÂ´s works without copy files.

rubyscript2exe solve all dependencies. For begginers itÂ´s better:  
ruby rubyscript2exe.rb -rubyw /application/.rb  
in the folder in your main ruby file (/application/.rb)

I have a ruby main file with a class a many other ruby files in a folder  
called “modulos” extending the class of the main file.

I have done an application in windows with GTK, pdf::writer and Sqlite  
and works fine.

Finally i have:

- GLADE FILE
- Sqlite database.
- Executable with SQLite DLL inside, and GTK dependencies inside.

ItÂ´s a little slow to start (like JAVA) due to DLLs, but it works fine.  
Only 3 files.

> * * *
> 
> ```
> If someone thinks it's a useful addtion to the Hiki, could someone
> 
> ```
> 
> add it (or give me a password)? Thanks!

I want contribute to the wiki if itÂ´s possible also.
