Tom
Tom

Reputation: 61

Java Exception when Trying to Run Grails

All - I just downloaded the latest grails (2.1.0) and JDK (1.7.0_07) on my Win7 64bit machine and configured my machine as follows:

1.) Added environment variables for Java and Grails
2.) Update PATH as appropriate
3.) Verified that everything installed correctly by executing java -version and grails -version

The java -version command works, and shows the following:

java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

but the grails -version command yields the following error:

Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread “main”

I tried debugging by completely uninstalling all Java, then reinstalling, but the same error occurs. I verified that I installed the 64 bit version of Java.

More information about the error can be found at this website (Mike [the owner] directed me to Stackoverflow for more help).

Any idea is to why this occurred? What can I do to get Grails working? Thanks in advance for your help.

-Tom

Edit 1 from Vector's comment:

All variables are set properly and shown here:

GRAILS_HOME = C:\grails\grails-2.1.0 
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_07 
Path = [lots of other stuff];%JAVA_HOME%\bin;%GRAILS_HOME%\bin;

Edit 2 Fixed java version number at top of problem statement (version is 1.7.0_07) per @crudolf

Upvotes: 5

Views: 3751

Answers (6)

Ujjwal Singh
Ujjwal Singh

Reputation: 4988

Try deleting the file .grails_history file located in your %Home% directory. This worked for me on Windows 8.1

Upvotes: 0

user2195918
user2195918

Reputation: 181

I ran into this problem with Grails 2.4.0 and 2.2.4 on Windows 8.1 Pro. I noticed that the problem did not occur if I ran the grails command in an administrator cmd-shell. I then checked my Appdata\Local\Temp. It turned out that the security setting for the temp folder needed to be changed. After I gave Everyone the full access to Appdata\Local\Temp folder, the problem was solved. But you may need to check the security setting often because some Windows Apps reset the security setting.

Upvotes: 1

chege
chege

Reputation: 323

I was having a similar problem but in Ubuntu 12.04. I solved it by removing $GROOVY_HOME environment variable. If you also have $GROOVY_HOME variable try removing it.

Upvotes: 0

Chris Stephens
Chris Stephens

Reputation: 71

I ran into this error after attempting to upgrade from Grails 2.1.0 to Grails 2.2.1 on Windows 7.

I simply had to delete the C:\User\%USERNAME%\.grails and C:\User\%USERNAME%\.groovy folders created by and leftover from Grails 2.1.0.

It appeared that Grails was loading some leftover cached JARs or configuration files of .grails and .groovy instead of %GRAILS_HOME%.

It took hours, but I learned my lesson - delete ".grails" and ".groovy" before running a new version of Grails!

Upvotes: 1

jichi
jichi

Reputation: 6623

I was having the same problem. I was having a working grails-2.2.4 with java-1.7.25 on a Windows 7 x86. But it suddenly stopped working today. I tried removing ~/.groovy and ~/.grails, but still got java.lang.RuntimeException thrown from the UncaughtExceptionHandler.

Finally, the problem was solved by removing ~/.m2 as well.

BTW, "set DEBUG=1" before starting "grails" in a Command Prompt will show the environment and parameters to launch Java.exe.

Upvotes: 0

Tom
Tom

Reputation: 61

Answer: Thou shalt ensurest that thine box is set to Administrator . . . and the people rejoiced.

Apparently, Grails wants to write to C:\Users\Administrator.grails and C:\Users\Administrator.groovy. Even though I had admin rights on my machine (since I successfully installed Java), I apparently needed to click through into the Administrator folder in order for the preferences to be written that I wanted to use JDK.

All is well. Thanks everyone for your help.

Upvotes: 1

Related Questions