1

I am following Scheduled Jobs with Custom Clock Processes in Java with Quartz and RabbitMQ but I struggle to actually run another dyno from withing the jar file packeg by Spring.

In the package (server-1.0-SNAPSHOT.jar) I need to run the company.server.Scheduler. The .class file is in BOOT-INF/classes.

I've tried to do this but I am always getting

Error: Could not find or load main class company.server.Scheduler

I'm struggling to get the syntax right.

So what I need to run is

BOOT-INF/classes/company/server/Scheduler.class

I have tried this:

java -classpath BOOT-INF/classes -jar server-1.0-SNAPSHOT.jar company.server.Scheduler
java -classpath server-1.0-SNAPSHOT.jar:/BOOT-INF/classes company.server.Scheduler

But this either runs the main class from the Manifest or crashes.

Also tried:

java -classpath server-1.0-SNAPSHOT.jar BOOT-INF.classes.company.server.Scheduler
java -classpath server-1.0-SNAPSHOT.jar BOOT-INF/classes/company/server/Scheduler

Try it out ...

git clone https://github.com/silentsnooc/run-scheduler
cd run-scheduler/
mvn clean install
cd target/
java -cp .:scheduler-test-1.0-SNAPSHOT.jar BOOT-INF.classes.Scheduler

If I follow this on Heroku then it should be something like

java -cp scheduler-test-1.0-SNAPSHOT.jar:BOOT-INF/classes/* Scheduler

but it's not working telling me the main class Scheduler could not be found.

Stefan Falk
  • 23,898
  • 50
  • 191
  • 378

0 Answers0