Showing posts with label NetBeans. Show all posts
Showing posts with label NetBeans. Show all posts

Thursday, 12 March 2009

NetBeans, Gems, Rails, and Permissions

I've gone from being a shell/make/rcs guy to quite liking IDEs, or at least useful IDEs. I find NetBeans to be a pretty nice, light-weight (in the good sense) IDE, but it has some issues on Ubuntu and other properly secured OSs. Here's how I've got it to work. This applies to NetBeans 6.1 and 6.5, I believe.

First, you have to set up your Ruby platforms so they keep their gems in writable directories. Go to Tools-> Ruby Platforms. On NetBeans 6.5 (at least), the jRuby gems are in a writable, per user path by default. If you click on the "Autodetect Platforms" button and get the native Ruby platform, change the "Gem Home:" and "Gem Path:" directories to somewhere writable, like /home/reid/ruby/gems/1.8.

While you're here, make sure the version of /usr/bin/gem is 1.3.1 or higher. If it isn't, I think you have to upgrade from a shell. I did that upgrade a while ago, so I don't remember how to do it, but you can find out easily through Google. (Ubuntu users may want to look here.)

It should all look like this:

Now go re-install all the gems you need through Tools-> Ruby Gems.

At this point, you still may not be able to install plugins. You'll get the following message: "Missing the Rails 2.2.2 gem" (or whatever version NetBeans installed for you). Rake from within NetBeans seems to look at the system rails executable, and not the one installed through the NetBeans' own gem installer. But the environment.rb generated for a new application does use the version of Rails installed by NetBeans. What I did (yuck, because there's some redundancy here) is manually install the appropriate Rails version:
sudo gem install rails
I'm sure there's a better way, but I can't think of it right now and I really want to write some Rails code instead of fighting with NetBeans.

Wednesday, 15 October 2008

Netbeans Rake Menu Missing

In NetBeans 6.1, I created a new project and the "Run Rake Tasks" menu was empty (it only said "Refresh List"). I found someone else through Google who had the same problem, but no solution other than "use NetBeans 6.5 beta".

After fooling around a bit, I simply un-installed Rails 2.1.1 and re-installed it and voila, the "Run Rake Tasks" menu was populated with all its tasks. Bizarre.

P.S. It wasn't completely random that I chose to re-install Rails 2.1.1. When I tried to check on the plug-ins I had installed, I got a message that said to install Rails 2.1.1. My gems list said it was already installed, so I decided to un-install it and then install.

Thursday, 24 April 2008

NetBeans Out of Memory Updating Ruby Gems

I got a message "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" while updating Ruby Gems in NetBeans 6.0.1 on Windows XP. It took a little longer than usual for me to find reports of this problem using Google, but when I did I found that it is a known problem.

Someone suggested changing the command line arguments to NetBeans to increase the size of the memory for the JVM, but that didn't work for me. Instead, I figured out how to load gems from the command line, and once I did that one time, I was able to use the gem manager in NetBeans.

So, in more detail: Originally I had installed NetBeans from a privileged account using all the default options. To get new gems, in a non-privileged account, I had to create two environment variables with the following values:
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_05
set JRUBY_BASE=C:\Program Files\NetBeans 6.0.1\ruby1\jruby-1.0.2
Your values may differ, particularly the version numbers. I wrote it here as you'd do it in the command prompt window, but I actually did it using the System control panel.

I opened a comment prompt window and did:
%JRUBY_BASE%\bin\gem install login_generator
After a couple of minutes, everything seemed to end normally. I did Tools->Ruby Gems from a running NetBeans instance and didn't get the desired results, so I restarted NetBeans and then Tools->Ruby Gems got me a list of gems, including login_generator as an installed gem.