5

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?

2
  • show your project structure..! Commented Sep 29, 2014 at 13:35
  • it is only the Main file, it is a "from scratch" project downloaded from GitHub Commented Sep 30, 2014 at 12:13

3 Answers 3

7

Quotes and semicolon

web: java %JAVA_OPTS% -cp target\classes;"target\dependency\*"  Main
Sign up to request clarification or add additional context in comments.

4 Comments

are you editing your Procfile to look like the above? If you have a separate file for Windows, like I have, you need to specify it when starting foreman. 'foreman start web --procfile=Procfile.win'
web: java -Xms256m -Xmx512m -cp target\classes:"target\dependency\*" Main this is my Procfile.win and I run it with foreman start web --procfile=Procfile.win and I get the same error in the original question.
try changing the colon to a semi colon
Note that if %JAVA_HOME% is not set, this can fail (because it thinks "%JAVA_HOME%" is the class name.
3

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.

Comments

1

Same problem with java-getting-stared app downloaded from heroku server. Changing to ";" works on Windows. Still need ":" on heroku linux server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.