larand
larand

Reputation: 831

Grails, Can not run WAR-file

When I try running my WAR-file I'll get this:

$ java -Dgrails.env=prod -jar build/libs/MyWar-0.45.war
Error: Could not find or load main class  build.libs.MyWar-0.45.war

Have these versions:

grailsVersion=3.3.3
gormVersion=6.1.6.RELEASE
gradleWrapperVersion=3.5
jdk1.8.0_161

It worked on grails 3.3.0. Any ideas?

Upvotes: 0

Views: 1141

Answers (3)

Chaz B.
Chaz B.

Reputation: 21

grails "-Dgrails.env=prod" run-app

Powershell only recognizes the -Dgrails.env=prod command if it's quoted.

I successfully ran this command from a PS terminal within IntelliJ IDEA and from Windows Powershell.

Upvotes: 0

larand
larand

Reputation: 831

The problem, it seems, is that the new version of windows10 (1709) doesn't have the command prompt visible in the start-menu. Instead, there is PowerShell and "java -Dgrails.env=prod" doesn't work in PS. It worked when I removed "-Dgrails.env=prod" from the command. But when I tried RUN-cmd to get the old command window then the complete command worked. So it seems to be some problem with this command using PowerShell.

This solved my problem but if anyone could explain what's wrong or how you could make it work with PowerShell it would be welcome.

Upvotes: 0

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27245

Instead of java -Dgrails.env=prod build/libs/MyWar-0.45.war you probably want java -Dgrails.env=prod -jar build/libs/MyWar-0.45.war.

Upvotes: 1

Related Questions