1

I try to deploy java on Heroku. I follow the steps on Heroku ,But I get error on

java -cp target\classes;"target\dependency\*" HelloWorld

the error is : Error: Could not find or load main class HelloWorld

How can I solve it? Is it case sensitive?

I found helloworld key word in pom.xml, so I try to change it to HelloWorld. It still does not work. btw, I am running windows 7(64 bit) with jdk1.7.0_05.

2
  • Is this locally that it is not working? Commented Aug 21, 2012 at 12:32
  • thanks for reply, I decided to switch to Play! framework Commented Aug 26, 2012 at 3:12

2 Answers 2

2

Looks like you are using Windows-style path for the -cp flag. Heroku runs on Linux, so you probably need to change that to java -cp target/classes:"target/dependency/*" HelloWorld in the Procfile you are deploying to Heroku.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm running on Ubuntu 12.04 with the same problem so perhaps not.
Amazing bro. you saved me 7 days of hard debugging.
0

For any avid readers who are trying to follow Heroku's getting started tutorial and are attempting to deploy locally and are receiving this error...

It is likely that you haven't built the target classes locally (they don't explain it very well in the tutorial).

If you are following the getting started guide with Maven then execute the following maven command in your project root folder to build your target locally:

mvn clean install

After that the local deployment commands like:

heroku local web -f Procfile.windows

should work as expected. (Obviously substitute Procfile.windows with just Procfile if you are not deploying under Windows)

You should then see something like:

Started ServerConnector@4d29c891{HTTP/1.1}{0.0.0.0:5000}

and can access your application locally by navigating to localhost on the port that was displayed:

localhost:5000

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.