Java classpath separator is platform dependent, ;
for Windows and :
for Unix.
If you are trying to run heroku local
on Windows, your command will fail with exactly the message you posted. Replacing it with:
web: java -cp target/classes/;target/dependency/* com.x.y.Main
will make it run on Windows.
If you get this error with the app deployed in the cloud (which is Unix), then there is no com.x.y.Main
class in the target/classes
directory. You can verify that by running heroku run bash
followed by ls -lR
and checking the directory/files layout on the server.
If you run on Windows ensure to run mvn clean install
to compile the sources into target/classes
directory.
For Gradle based projects you would need to adjust the classpath since it uses the different layout (build/classes
) or the jar file in build/libs
, see the guide for the details:
web: java -jar build/libs/myprojectname-1.0-SNAPSHOT.jar
To make it work in cloud and on Windows without changing Procfile every time, create Procfile.windows
with web: java -cp target/classes/;target/dependency/* com.x.y.Main
and start the app using heroku local web -f Procfile.windows
command locally.