1

I'm using Ubuntu and i have installed Griffon by taking the steps from this site. Even though there is no error in my installation. When i try to run the Griffon app using the command :

griffon run-app

I'm getting the error as:

java.io.IOException: Cannot run program "null/bin/java" (in directory "/home/anto/anto/staging"): java.io.IOException: error=2, No such file or directory
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at org.codehaus.griffon.cli.GriffonScriptRunner.executeWithGantInstance(GriffonScriptRunner.java:659)
    at org.codehaus.griffon.cli.GriffonScriptRunner.callPluginOrGriffonScript(GriffonScriptRunner.java:518)
    at org.codehaus.griffon.cli.GriffonScriptRunner.executeCommand(GriffonScriptRunner.java:300)
    at org.codehaus.griffon.cli.GriffonScriptRunner.main(GriffonScriptRunner.java:116)
    at org.codehaus.griffon.cli.support.GriffonStarter.rootLoader(GriffonStarter.java:198)
    at org.codehaus.griffon.cli.support.GriffonStarter.main(GriffonStarter.java:223)
Caused by: java.io.IOException: Cannot run program "null/bin/java" (in directory "/home/anto/anto/staging"): java.io.IOException: error=2, No such file or directory
    at RunApp$_run_closure2.doCall(RunApp.groovy:100)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at RunApp$_run_closure1.doCall(RunApp.groovy:32)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    at java_util_concurrent_Callable$call.call(Unknown Source)
    ... 7 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    ... 12 more

How to escape from this and run my first Griffon app?

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
Ant's
  • 13,545
  • 27
  • 98
  • 148
  • `null/bin/java` is probably being expanded from `$JAVA_HOME/bin/java`. Is the `JAVA_HOME` environment variable set properly? – ataylor Aug 30 '11 at 15:41
  • How do i set that? I'm new to Ubuntu. – Ant's Aug 30 '11 at 16:28
  • Add `export JAVA_HOME=/usr/lib/jvm/java-6-openjdk` to your `.bashrc`, substituting your actual JDK path. Try `readlink /etc/alternatives/javac` if you're not sure where your JDK is installed. – ataylor Aug 30 '11 at 16:40
  • this works perfect. Please enter this as an answer and I will accept it :D – Ant's Aug 30 '11 at 16:58

4 Answers4

5

null/bin/java is probably being expanded from $JAVA_HOME/bin/java.

To properly set your JAVA_HOME on an Ubuntu box, add export JAVA_HOME=/usr/lib/jvm/java-6-openjdk to your .bashrc, substituting your actual JDK path. Try readlink /etc/alternatives/javac if you're not sure where your JDK is installed.

ataylor
  • 64,891
  • 24
  • 161
  • 189
  • 1
    Just for the record, as they say [here](http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/), in MacOSX you should `export JAVA_HOME=$(/usr/libexec/java_home)`. – mgarciaisaia Oct 24 '14 at 20:58
0

It looks like that ppa package is broken.

** Best to use the standard installation method: http://groovy.codehaus.org/Installing+Griffon .

However, it's possibly just because you need to set JAVA_HOME environment variable, and possibly install the JDK itself? ... approximately:

sudo apt-get install sun-java6-jdk
sudo echo "export JAVA_HOME=/wherever/java/is/installed" > /etc/profile.d/java.sh
sudo chmod a+x /etc/profile.d/java.sh
. /etc/profile.d/java.sh    

HTH

laher
  • 8,860
  • 3
  • 29
  • 39
  • I have installed Java properly. Grails running on my Pc – Ant's Aug 30 '11 at 11:22
  • If set, and you're comfortable setting ENV vars, then try installing GRIFFON normally, according to that link – laher Aug 31 '11 at 02:41
  • ah, I just saw your answer to a comment above. My answer also would have worked! (/etc/profile.d/*.sh is effectively processed at the same as .bashrc , but it works for all users ...) – laher Aug 31 '11 at 02:43
0

It looks like you don't have Java installed/configured properly. Type the following at the command line:

java -version

You should see output similar to:

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

If not, you need to install Java (if it's not already installed), then set a JAVA_HOME environment variable to the directory where Java is installed. You should also add $JAVA_HOME\bin to your $PATH variable

Dónal
  • 185,044
  • 174
  • 569
  • 824
  • I have installed Java properly. Grails running on my Pc – Ant's Aug 30 '11 at 11:20
  • Did you do the command-line test above? If you're running Grails from an IDE then it will work even if you don't have the environment variables set – Dónal Aug 30 '11 at 11:34
  • Ya i tried it! And anyhow I use Grails using command-prompt only! I guess the error is somewhere else :( – Ant's Aug 30 '11 at 11:36
0

Sometimes, some ubuntu package upgrades or new installs break (some of) the configured java* alternatives. When this happens, check and correct them into a shell:

Type 'update-alternatives --config java' and type the [TAB] key twice in order to use the bash completion and see all java* alternatives.

Now, check and correct them one by one if needed: 'update-alternatives --config java' etc..