Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6246779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:45:12+00:00 2026-05-24T12:45:12+00:00

I’ve made a NSIS script to create an installer for a Rails application. The

  • 0

I’ve made a NSIS script to create an installer for a Rails application.
The application uses JRuby and Java.

In the first section of the installer I set the environment variables: I add jruby\bin to PATH and I create JAVA_HOME variable, which points to Java\jre6.

!define JRubyBinPath "$PROGRAMFILES\${PRODUCT_PUBLISHER}\JRuby\jruby-1.6.3\bin"

Function SetEnvVars    
    # set JAVA_HOME
    ${EnvVarUpdate} $0 "JAVA_HOME" "A" "HKCU" "C:\Program Files\Java\jre6"  
    # add jruby to Path
    ${EnvVarUpdate} $0 "Path" "A" "HKLM" "${JRubyBinPath}"          
FunctionEnd

Section "Pre" SEC01     
    Call SetEnvVars 
    ...
SectionEnd

** All the paths are correct. **

In the second section of the installer, after packing all the application files and JRuby files, I initialize the database using the following commands:

Section "Installer" SEC02

...

    SetOutPath $INSTDIR
    nsExec::ExecToLog "jruby -S bundle exec rake db:create RAILS_ENV=production"
    nsExec::ExecToLog "jruby -S bundle exec rake db:migrate RAILS_ENV=production"
    nsExec::ExecToLog "jruby -S bundle exec rake db:seed RAILS_ENV=production"      

...

SectionEnd

The problem is that when I run the installer on a clean Windows system, all the code executes correctly, except for the lines that contain commands using “jruby”. I get no error in the installer window, it just won’t execute those lines.

Anyway, if I manually run those commands in a console right after the installer finishes, everything works as expected.

From what I have seen so far, the problem is that the installer cannot access the environment variables until it finishes.

* What I have done so far to solve this problem is creating the main installer Installer.exe (here I pack all the files and I set the environment variables), and another executable Init.exe which initializes the database.
If I manually run these executables – first Installer.exe then Init.exe – the application installs correctly. But if I try to launch Init.exe from Installer.exe, it won’t work.

However, if there would be a way to execute the “jruby” commands in a new/different thread than the one that sets the environment variables, I think the problem would be solved. But I still couldn’t find the way to do that.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:45:12+00:00Added an answer on May 24, 2026 at 12:45 pm

    NSIS doesn’t have any threading. Apparently not quite true—but in your own code, you don’t get to use threads.

    You may need to set PATH for the current process; I’m not familiar with ${EnvVarUpdate}, but looking at its script it doesn’t seem to updates the variable in the current process. Try this:

    ${EnvVarUpdate} $0 PATH A HKLM "${JRubyBinPath}"  # The line you already have
    System::Call Kernel32::SetEnvironmentVariable(t"PATH",tr0)
    

    Another note: you are hard-coding JRubyBinPath; are you sure you really want to do that?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.