Lock jruby to ruby 1.9 permanently - netbeans

I want my jruby 1.6.1 installation to operate with ruby 1.9 mode only. I want to uninstall or surely disable the support for 1.8.7 because I do not want to pull my hair out if I forget to set the environment or the command line parameter somewhere.
And also! I have another JRuby (1.5.1) installation on my machine which I want to keep there in safety using ruby 1.8.7. I would like to have ruby 1.9 compatibility when (and only when) I choose "c:\opt\jruby-1.6.1" as "Ruby platform" in NetBeans, or I set my PATH to include "c:\opt\jruby-1.6.1\bin", and so on.
All words in one: I want to lock my jruby installation to a ruby version regardless of the environment. Or is there a jruby 1.6.1 installer with ruby 1.9 exclusively? If not, why not? Should I even wish for that?

You can specify the JRUBY_OPTS environment variable: JRUBY_OPTS = --1.9
If you do it in your Windows system environment variables it will always apply anywhere a JRuby executable runs.
If you only add it to your Netbeans project properties then you could have it different depending on which configuration you select. e.g. Don't set it for your JRuby 1.5.1 configuration.
You cannot have it change automatically just by changing your PATH environment variable though.

Related

Putting MinGW under configuration management

I have an application that gets built under MinGW. I have my source code under Git, but I ought to have my build environment under proper configuration management too, so that if I need to repeat a build from 6 months ago I can do it with the same versions of the compiler, libraries etc.
Is there any way of doing this? I've read up on "repeatable" builds, but that seems to be about running the build twice with the same versions of everything and getting a bitwise identical output, which is necessary for certain security properties. My problem is how to restore the version of MinGW files that I had at some point in the past.
The crude and primitive way would be to just archive a snapshot of C:\mingw every time I use pacman. But I'm hoping for something a bit smarter.
The standalone builds of MinGW-w64 from http://winlibs.com/, which can build for both Windows 32-bit and 64-bit, have no installation procedure. Just extract the download and you have a working build environment.
This even allows you to even have multiple versions of MinGW-w64 side by side.
Just make sure no other installed MinGW (like the one in C:\mingw) is in your PATH so the different versions don't get accidentally mixed up.

TieredCompilation is disabled in this release - running Leiningen in Counterclockwise

I'm running Leiningen in Counterclockwise in Eclipse (Windows, if it's relevant).
The thing is, when I run Leiningen from the command prompt, it runs just fine. However when I run it inside Eclipse, although it runs fine it haunts me with the following warning:
Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.
The only relevant thing I found on the Internet is this. However the solution doesn't work for me as I don't have this line in lein.bat file. I've tried fiddling with Java options in lein.bat to enable TieredCompilation explicitly with no avail. I'm trying to understand - what's different when Eclipse runs lein, compared to when I run it from the prompt, how does it run it? How do I hide this message?
EDIT: this warning seems to appear only in 32-bit JVM; for anyone having the same problem, using 64-bit JVM solves it. For anyone that as to use 32-bit JVM for whatever reason, I'm still looking for a good solution.
(converted from comment as I have to add additional info)
CCW uses its own version of Leiningen - for example, when I execute lein version from inside CCW I get 2.5.1, but if I drop to the command line and execute the same command I get 2.7.1. In my install (Neon + CCW - couldn't make the standalone CCW install work) there's a leiningen-standalone.jar in C:\eclipse\plugins\ccw.core_0.35.1.STABLE001. There may be a way to get Counterclockwise to use a separate version of Leiningen - perhaps more knowledgeable users will chime in with how to do this.
Also note that in the Windows install of Leiningen the LEIN_JVM_OPTS environment variable isn't defined at all in lein.bat, although it is used when invoking Java. Thus it seems you have two options:
Less-preferred option: edit lein.bat and add the definition of LEIN_JVM_OPTS, probably somewhere near the beginning of the file. This has the disadvantage that when you upgrade Leiningen you'll lose your definition of LEIN_JVM_OPTS and have to find this message again.
More-preferred option: since this is Windows you can go into Control Panel, type "environ" in the search box, then click on on the "Edit environment variables for your account" link which comes up under System (or click on "Edit the system environment variables" if you like). Create a new entry for LEIN_JVM_OPTS, specifying something like
-XX:-TieredCompilation
and you should be good to go. While I don't know for certain if this environment variable is used by the standalone .jar version of Leiningen I'd certainly hope and expect it would be.
Best of luck.

Rubymine can't find SDK. Where is it?

I have just installed rubymine 5.4.3.2.1 and am trying to start an example project. The problem i am having is that rubymine is asking for a SDK. So where do i point it to?
You should point it to the where you keep your Ruby Binary File, for example:
Windows - d:\dev\Ruby19\bin\ruby.exe
Mac Brew - /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
Ruby Version Manager - /Users/<user>/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
Linux/Mac Default - /usr/bin/ruby
If you are on Windows and don't have Ruby installed yet, download it from http://rubyinstaller.org/ .
After installing point RubyMine to the ruby.exe file location.
For example, if you install using rubyinstaller-2.0.0-p247.exe into c:\Ruby200 (the default path suggested by the installer), RubyMine would accept c:\Ruby200\bin\ruby.exe path for the SDK (it will even detect it automatically):
Note that it's also recommended to install and configure the DevKit from the same site as it's required for many gems that have native code.
When everything is installed you can follow the Quick Start Guide for RubyMine.
If you are on windows its where ever you installed ruby under the bin folder as diplayed here If you are on a unix base system go to the terminal and enter which ruby and you will point it to the directory listed. Assuming you have ruby installed
Only for Mac, brew, rbenv:
$ which ruby
/usr/local/var/rbenv/shims/ruby
But it doesn't show used gems. So, it's better to add file inside ruby version folder: /usr/local/var/rbenv/versions/*your_version*/bin/ruby
Ruby path in Rails Container: /usr/local/bin/ruby (no RVM installed)
Local Ruby path: ~/.rvm/rubies/ruby-2.6.0/bin/ruby (no default Ruby installed)
Local RVM path: ~/.rvm/bin/rvm
Yes when you add a remote interpreter using rbev, just add the path you get via this command:
which ruby
and it should work fine
If you're sure you have installed the correct Ruby, I've found that invalidating caches and restarting RubyMine can clear this up. You'll find this option on the File menu.
I'm not sure why this works, but it definitely fixed this exact problem for me today.

check for JRE on system

I have an existing Java program that I am giving to some.... not so technically inclined clients of mine. They use a combination of Linux, Windows, and very few have apple machines, which is why I chose Java to develop the program in. The problem is they keep calling me with errors when they try to launch the program because they do not have a JRE installed. Is there any way to:
Import a lib that will give me some kind of command to check.
Add something to the program that will check for the JRE.
or (and I really don't want to go about this because of the reason I chose java in the first place)
Write something in C++ that will check for the JRE.
My aim:
Check if JRE installed on machine
If yes: Launch program
If no: pop up a message saying "No Java Environment found, downloading from Java website". Then I would take them directly to the link where they hit "run" and it installs.
// i would do something like
if (JRE.exists()) // maybe use a pathname that would only show up if a JRE is installed
{
// launch program
}
else
{
// launch Java installer
}
system.exit(0);
I understand this would be really hard in java (as you cannot run Java programs without a JRE) but I prefer to keep this universal if at all possible.
If there is no easy fix, I'll just make a read-me file that has the link to the java website that checks for a JRE on your system, but the least amount of work the user has to do the better.
I would suggest you use an Java installer like IzPack or other such free tools. Using one of these you can create an installer and also generate a native launcher. This can be configured such as it searches for Java and if not found, it can help the user installing it.
There are developers that also use JSmooth or Launch4J for native launchers.
check for JRE on system
Use deployJava.js as mentioned in the Java Web Start info. page.
..designed to ensure a suitable minimum version of Java is installed before providing a link to a JWS app. or launching an applet.
If it is a rich client desktop app. (e.g. applet or frame), deploy it using Java Web Start.
If you can't go with Java Web Start, although I'd recommend using it, you can write simple scripts to detect Java.
For Windows (.bat):
if not "%JAVA_HOME%" == "" (
"%JAVA_HOME%\bin\javaw.exe" -jar YourApp.jar
) else (
start http://java.com/download/
)
If JAVA_HOME environment variable is defined, then javaw.exe will be started with your application jar file. The javaw.exe executable uses window subsystem thus it runs without console window.
If JAVA_HOME is not set, it will open the Java download page in the default browser.
For more options, you can use JScript; with it you can display a warning to users that Java is not installed and then open the browser for download.
For Linux (.sh):
if [ "$JAVA_HOME" != "" ]; then
$JAVA_HOME/bin/java -jar YourApp.jar &
else
echo JAVA_HOME is not set: Java Runtime Environment (JRE)
echo is not installed your system.
echo Either install it from http://java.com/download/
echo or set JAVA_HOME environment variable.
fi
why don't you just create batch and bash files doing that and ask your customer to run one or the other dependently on the OS
if the JRE is installed on a system, then JAVA_HOME environment variable is set on both Windows and Linux and it contains the path of JRE. You can check if this variable is set and accordingly proceed.

Running 32bit JRE on a 64bit windows 2008R2 server

I am trying to run an application called vdbench on my windows2008R2 which is a VM. However, the application does not have 64 bit support and can be only run with 32 bit version of Java. I am trying to understand if I can install the 32 bit JRE and run the application on the windows2008R2 64 bit server? I tried it but the application is not able to run saying 'java' is not recognized as a program. I am wondering if I need to map my windows2008R2 to run the specific 32bit version of JRE?
You need to do nothing except install the 32-bit JRE / JDK whatever your requirement.
I do this all the time. The only real reason to use the 64-bit version is if you application needs to be able to access more than 4GB of RAM (or some programmatic lib dependency)
Make sure you install the 32-bit version and point the JAVA_HOME environment variable to the install dir so if you install JRE 1.6 it JAVA_HOME should be something like
C:\Program Files (x86)\Java\jre1.6.0_XX
Also, in your Path environment variable add %JAVA_HOME%\bin to its end, this will make all the java executable's available at the command line.
In the case of a JRE you can use an environment variable called JRE_HOME if you want instead of JAVA_HOME.
You can also add -d32 to the JVM options, which should tell the JVM to run in 32-bit mode.
You must install a 32-bit JDK or JRE. Then, add a new system environment variable named EXE4J_JAVA_HOME pointing to the new install dir (there's no need to overwrite the JAVA_HOME env. var.).