Ruby Executable Won't Start on Win10 and Win7

Ruby executable won't start on Win10 and Win7

I solved by installing this ruby version:

G:\WinRuby\efdsk>ruby -v                                                                                                
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]

And this is the command i used for ocra:

ocra efdsk.rb --windows C:\Ruby23-x64\lib\tcltk\ --no-autoload --add-all-core

Now the exe file will run normally after double clicking it.

Cmd pop up while running rubyw or an exe built with ocra

I solved by myself.

First, i required this in my script:

require 'win32ole'

Then i made a batch file, containing the command i need to be printed on a file, in this case ip config > info.txt, and i named it run.bat.

After this, I replaced system() with the following:

WIN32OLE.new('Shell.Application').ShellExecute('run.bat','','','open',0)

This will work too:

WIN32OLE.new('WScript.Shell').Run("run.bat",0,0)

Here the documentation for win32ole

As first parameter i used the batch file i just created, and the last parameter, the 0, made the trick. It sets the new cmd window to be hided and so it wont ever pop up again.

I tried with rubyw efdsk.rb and also to build an exe with ocra. No annoying windows popping up.

Setting filepaths inside your .rb file when converted into an exe with ocra

In the ocra documentation it mentions Dir.chdir File.dirname($0) but I didn't get what it meant when it was mentioned.

If you need to use say an image file in your script you can make sure it works merely by having this Dir.chdir(File.dirname($0)) line before you try to use any of your images.

For example in my app I'm using an image file and I couldn't get my exe to work if it wasn't in the same dir as the file but with the below it works anywhere so far.

Dir.chdir(File.dirname($0))
shape = File.join('warning3.png' )

I think this sets the script's current directory to the exe's directory inside it? If I'm wrong please let me know!

Ruby MYSQL2 gem installation on windows 7

EDIT 30/09/2014

When this answer was posted the 64 bit rails installer wasn't the recommended version - it now seems people are starting to use it more. It should be noted when you download the MySQL Connector you need to download either 64 or 32bit to correspond to the version of rails you installed.

Amazingly I lucked upon an answer very early this morning as I happened to be looking for something else of a similar nature. I'm not quite sure why there isn't a single simple guide for this as it appears to be very straight forward!

For some reason just specifying the mysql-dir when you install the gem doesn't pick up with other sub directories so you need to set the parameters manually.

For anyone else experiencing the same problem, I did the following:

1) Download the MySql C Connector from: http://dev.mysql.com/downloads/connector/c/

NOTE Don't download the installer, download the ARCHIVE for your OS

Download either the 32bit or 64 bit ARCHIVE to correspond with the version of rails you installed.

2) Extract the file to C:\mysql-connector

3) Then ran:

 gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-connector"'

Voila everything is working fine.

EDIT 30/01/2014

I just had to do a fresh install on a bricked machine and the command in step 3 didn't work, what did work was:

gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector"'

I'm not quite sure what the difference is but this time it seems to be picking up the directories ok, so if the first one doesn't work try this one!

I think this has to do with how you go about installing rails, this time round I used the railsinstaller which seems to set the paths up correctly.

A lot of the outcome here seems to depend on the shell your using, a lot of people are having problems with powershell so I wouldn't advise using it. I did this in an elevated command prompt.

Oh and lastly if you get an error regarding the mysql2 gem when you do RAILS S you need to copy the libmysql.dll from the LIB directory of the mysql connector to the bin directory where rails has been installed.

Cannot install Aptana Studio 3.6 on Windows

Installing Aptana Studio in passive mode bypasses the installation of Git for Windows and Node.js.

Aptana_Studio_3_Setup_3.6.1 /passive /norestart

(I am unsure whether Aptana Studio will work properly without those "prerequisites", but it appears to.)

If you want a global installation in a specific directory, the command line is

Aptana_Studio_3_Setup_3.6.1.exe /passive /norestart ALLUSERS=1 APPDIR=c:\apps\AptanaStudio


Related Topics



Leave a reply



Submit