윈도우에서 Grails 2.1.1 을 설치한 후, 한경변수 GRAILS_HOME, JAVA_HOME, PATH 가 모두 잡혔는데도 불구하고 "rails create-app" 명령시 에러
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jre7
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
가 나는 경우가 있다. (리눅스/유닉스에서는 이런 경우가 없음 )
이럴 때는 startGrails.bat 파일을 텍스트 편집기로 열어서 42번째 줄
%COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
을
@rem %COMMAND_COM% /C DIR "%JAVA_HOME%" 2>&1 | %FIND_EXE% /I /C "%JAVA_HOME%" >nul
로 고쳐서 주석처리 한다. 그러면 "grails create-app" 명령이 잘 된다.
다음은 C:\test\grails 폴더에서 helloworld 애플리케이션을 성공적으로 생성한 경우의 출력이다.
C:\test\grails> grails create-app helloworld
| Downloading: c:\GRails211\lib\org.springframework.uaa\org.springframework.uaa.
| Downloading: c:\GRails211\lib\com.googlecode.json-simple\json-simple\ivy-1.1.x
| Downloading: c:\GRails211\lib\com.googlecode.concurrentlinkedhashmap\concurren
| Downloading: c:\GRails211\lib\org.springframework.uaa\org.springframework.uaa.
| Downloading: c:\GRails211\lib\com.google.protobuf\protobuf-java\jars\protobuf-
| Downloading: c:\GRails211\lib\com.googlecode.json-simple\json-simple\jars\json
| Downloading: c:\GRails211\lib\org.bouncycastle\bcpg-jdk15\jars\bcpg-jdk15-1.45
| Downloading: c:\GRails211\lib\org.bouncycastle\bcprov-jdk15\jars\bcprov-jdk15-
| Downloading: c:\GRails211\lib\org.springframework\spring-test\jars\spring-test
| Downloading: c:\GRails211\lib\com.googlecode.concurrentlinkedhashmap\concurren
| Downloading: c:\GRails211\lib\org.apache.ant\ant-launcher\jars\ant-launcher-1.
| Downloading: c:\GRails211\lib\org.apache.ant\ant-junit\jars\ant-junit-1.8.2.ja
| Downloading: c:\GRails211\lib\org.apache.tomcat.embed\tomcat-embed-core\jars\t
| Downloading: c:\GRails211\lib\org.apache.tomcat.embed\tomcat-embed-jasper\jars
| Downloading: c:\GRails211\lib\org.apache.tomcat.embed\tomcat-embed-logging-log
| Downloading: c:\GRails211\lib\commons-beanutils\commons-beanutils\ivy-1.8.3.xm
| Downloading: c:\GRails211\lib\commons-validator\commons-validator\ivy-1.3.1.xm
| Downloading: c:\GRails211\lib\commons-collections\commons-collections\ivy-3.2.
| Downloading: c:\GRails211\lib\org.hibernate.javax.persistence\hibernate-jpa-2.
| Downloading: c:\GRails211\lib\commons-fileupload\commons-fileupload\ivy-1.2.2.
| Downloading: c:\GRails211\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-1
| Downloading: c:\GRails211\lib\commons-beanutils\commons-beanutils\jars\commons
| Downloading: c:\GRails211\lib\commons-validator\commons-validator\jars\commons
| Downloading: c:\GRails211\lib\aopalliance\aopalliance\jars\aopalliance-1.0.jar
| Downloading: c:\GRails211\lib\commons-codec\commons-codec\jars\commons-codec-1
| Downloading: c:\GRails211\lib\commons-collections\commons-collections\jars\com
| Downloading: c:\GRails211\lib\commons-lang\commons-lang\jars\commons-lang-2.6.
| Downloading: c:\GRails211\lib\org.hibernate.javax.persistence\hibernate-jpa-2.
| Downloading: c:\GRails211\lib\org.springframework\spring-core\jars\spring-core
| Downloading: c:\GRails211\lib\org.springframework\spring-aop\jars\spring-aop-3
| Downloading: c:\GRails211\lib\org.springframework\spring-aspects\jars\spring-a
| Downloading: c:\GRails211\lib\org.springframework\spring-asm\jars\spring-asm-3
| Downloading: c:\GRails211\lib\org.springframework\spring-beans\jars\spring-bea
| Downloading: c:\GRails211\lib\org.springframework\spring-context\jars\spring-c
| Downloading: c:\GRails211\lib\org.springframework\spring-context-support\jars\
| Downloading: c:\GRails211\lib\org.springframework\spring-expression\jars\sprin
| Downloading: c:\GRails211\lib\org.springframework\spring-jdbc\jars\spring-jdbc
| Downloading: c:\GRails211\lib\org.springframework\spring-jms\jars\spring-jms-3
| Downloading: c:\GRails211\lib\org.springframework\spring-orm\jars\spring-orm-3
| Downloading: c:\GRails211\lib\org.springframework\spring-tx\jars\spring-tx-3.1
| Downloading: c:\GRails211\lib\org.springframework\spring-web\jars\spring-web-3
| Downloading: c:\GRails211\lib\org.springframework\spring-webmvc\jars\spring-we
| Downloading: c:\GRails211\lib\org.grails\grails-datastore-gorm\jars\grails-dat
| Downloading: c:\GRails211\lib\org.grails\grails-datastore-core\jars\grails-dat
| Downloading: c:\GRails211\lib\org.grails\grails-datastore-simple\jars\grails-d
| Downloading: c:\GRails211\lib\org.aspectj\aspectjweaver\jars\aspectjweaver-1.6
| Downloading: c:\GRails211\lib\commons-fileupload\commons-fileupload\jars\commo
| Downloading: c:\GRails211\lib\commons-dbcp\commons-dbcp\jars\commons-dbcp-1.4.
| Downloading: c:\GRails211\lib\commons-pool\commons-pool\jars\commons-pool-1.5.
| Downloading: c:\GRails211\lib\net.sf.ehcache\ehcache-core\jars\ehcache-core-2.
| Downloading: c:\GRails211\lib\org.slf4j\jcl-over-slf4j\jars\jcl-over-slf4j-1.6
| Downloading: c:\GRails211\lib\org.slf4j\jul-to-slf4j\jars\jul-to-slf4j-1.6.2.j
| Created Grails Application at C:\test\grails/helloworld
grails 애플리케이션 실행하기
C:\test\grails> cd helloworld
C:\test\grails\helloworld> grails run-app
웹브라우저로 http://localhost:8080/helloworld 를 방문한다.
첫번째 컨트롤러 만들기
C:\test\grails\helloworld> grails create-controller hello
[grails-app/contollers/helloworld/HelloController.groovy 파일의 내용]
package helloworld
class HelloController {
def index() { }
def world() {
render "Hello, world! <br />\n${new Date()}<br />\n"
render "안녕하세요? GRails 2.1.1<br />\n"
}
}
C:\test\grails\helloworld> grails run-app
웹브라우저로 http://localhost:8080/helloworld/hello/world 를 방문한다.
'소개와 설치 > GRails' 카테고리의 다른 글
Mac OS X 또는 Ubuntu 등의 리눅스에 Grails를 설치하고 간단한 테스트하기 (0) | 2012.12.02 |
---|