Announcement Announcement Module
Collapse
No announcement yet.
Roo and cygwin Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo and cygwin

    I type in roo in cygwin and it gives me:

    bash: roo: command not found

    I go to where roo is extracted and type in roo.sh and it gives me:

    java.lang.NoClassDefFoundError: org/springframework/roo/bootstrap/Bootstrap
    Caused by: java.lang.ClassNotFoundException: org.springframework.roo.bootstrap.Bootstrap
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: org.springframework.roo.bootstrap.Bootstrap. Program will exit.
    Exception in thread "main"

    Anyone using roo in cygwin? It works fine in the normal windows xp command line.

  • #2
    I did a quick test a few months ago, finding it worked if I use "cygpath". You can read a little more about using Java via Cygwin at http://www.inonit.com/cygwin/faq/. The main motivation I had for trying Cygwin was to see if the Roo shell services like colour would work better in Cygwin than they did in the native Windows shell, but sadly they didn't. They work just fine in *nix systems like Linux and Mac, but not in Windows.

    If you edit the roo.bat to better support Cygwin whilst also supporting non-Cygwin Windows operations, please feel free to contribute back any changes via http://jira.springsource.org/browse/ROO. We'd be happy to include the necessary improvements in future releases.

    Comment


    • #3
      I created a roo.sh that accounts for cygwin and the strange java running under cygwin

      I followed Ben's link. I noticed that both JBoss and mvn support cygwin so I looked how they did it and then hacked roo.sh into submission.

      Here is what I came up with.... (this roo.sh should work under Unix, Linux, MacOS and cygwin)...

      roo.sh that is cygwin friendly...


      #!/bin/sh

      PRG="$0"

      while [ -h "$PRG" ]; do
      ls=`ls -ld "$PRG"`
      link=`expr "$ls" : '.*-> \(.*\)$'`
      if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
      else
      PRG=`dirname "$PRG"`/"$link"
      fi
      done
      ROO_HOME=`dirname "$PRG"`

      # Absolute path
      ROO_HOME=`cd "$ROO_HOME/.." ; pwd`

      # echo Resolved ROO_HOME: $ROO_HOME
      echo "ROO HOME $ROO_HOME"
      echo "JAVA_HOME $JAVA_HOME"

      cygwin=false;
      case "`uname`" in
      CYGWIN*)
      cygwin=true
      ;;
      esac

      if [ "$cygwin" = "true" ]; then
      export ROO_HOME="`cygpath -wp $ROO_HOME`"
      export JAVA_HOME="`cygpath -wp "$JAVA_HOME"`"
      export EXT_DIR=""$ROO_HOME\\dist";"$ROO_HOME\\lib";"$ROO_ HOME\\work";"$JAVA_HOME\\jre\\lib\\ext""
      echo "ROO HOME $ROO_HOME"
      echo "JAVA_HOME $JAVA_HOME"
      echo "EXT_DIR $EXT_DIR"
      else
      export EXT_DIR="$ROO_HOME/dist:$ROO_HOME/lib:$ROO_HOME/work:$JAVA_HOME/jre/lib/ext"
      fi

      while true; do
      java -Djava.ext.dirs="$EXT_DIR" $ROO_OPTS -Droo.home="$ROO_HOME" org.springframework.roo.bootstrap.Bootstrap "classpath:roo-bootstrap.xml" $@
      EXITED=$?
      # echo Exited with $EXITED
      if [ $EXITED -ne 100 -a $EXITED -ne 200 ]; then
      break
      fi
      done

      Comment


      • #4
        http://jira.springframework.org/browse/ROO-561 tracks Cygwin. Would you mind attaching it there?

        Comment


        • #5
          Done

          Done. Thanks.

          Comment


          • #6
            I tried this roo.sh under cygwin, but it doesn't work. I tried hint and it simply hangs. I have all the variables JAVA_HOME, ROO_HOME set properly.

            --Irshad.

            Comment


            • #7
              probably not roo.sh

              RE: I tried this roo.sh under cygwin, but it doesn't work. I tried hint and it simply hangs. I have all the variables JAVA_HOME, ROO_HOME set properly.

              I successfully went through the tenminute walkthrough and created the initial starter application. The application ran fine with this roo.sh.

              I was able to build and run tomcat. I was able to access the application from my web browser.

              I don't think your issue is with the roo.sh file. I think you may have some other issue.

              If roo.sh was not working, I would not expect roo to hang. I would expect you to get an error message like a class not found or command not found.

              Comment


              • #8
                Thanks for attaching it. I'll send you the CLA separately so we're able to use the contrib.

                Comment


                • #9
                  Worked for me, but add M2_HOME

                  Hi,

                  Thanks for the Cygwin support! Works for me except I had to add a line for Maven support:

                  export M2_HOME="`cygpath -wp $M2_HOME`"

                  Comment


                  • #10
                    Current roo.sh Almost works

                    I installed roo this week. I use Cygwin. roo.sh almost works. However,
                    perform package
                    fails, complaining about my JAVA_HOME. Once I fixed that, it complained about M2_HOME. So the current roo.sh needs

                    export JAVA_HOME="`cygpath -wp "$JAVA_HOME"`"
                    export M2_HOME="`cygpath -wp "$M2_HOME"`"

                    added to the 'if [ "$cygwin" = "true" ]; then', at which point, it will at least "perform package" correctly.

                    Comment

                    Working...
                    X