I'm following the "Getting Started with Java on Heroku" guide at https://devcenter.heroku.com/articles/getting-started-with-java I follow the steps till I deploy and execute succesfully the application downloaded from GitHub. When I try to execute it locally on Windows XP with the command
foreman start web
I get the error:
web.1 | started with pid 3388
web.1 | Error: Could not find or load main class Main
web.1 | exited with code 1
system | sending SIGKILL to all processes
My Procfile is:
web: java %JAVA_OPTS% -cp target\classes:target\dependency\* Main
And
>echo %JAVA_OPTS%
-Xms256m -Xmx512m
Can anyone suggest me how to solve?
You can deploy any Java application on Heroku. It is not limited to JEE or other frameworks. You can deploy Java web applications packaged as WAR files using WAR deployment or you can deploy Maven based Java projects of any kind using the git versioning system.
Running your application locallySelect File > Open to open the project you want to run. Browse to the directory containing your project. Select Tools > Cloud Code > App Engine Run on a local App Engine Standard dev server.
I ran into this issue while running through the https://devcenter.heroku.com/articles/getting-started-with-java tutorial.
After tinkering with some of these answers I discovered that step six at https://devcenter.heroku.com/articles/getting-started-with-java#define-a-procfile tells the answer.
When you see instructions to run your app with foreman, append an extra -f Procfile.windows flag to ensure your Windows-specific Procfile is picked up. For example: foreman start web -f Procfile.windows
Once I switched to the foreman start web -f Procfile.windows command, everything worked smoothly.
Quotes and semicolon
web: java %JAVA_OPTS% -cp target\classes;"target\dependency\*" Main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With