Run main of specific class inside a package subdirectory












0















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.










share|improve this question

























  • is BOOT-INF/classes a folder inside the jar?

    – Timothy Truckle
    Dec 29 '18 at 18:38











  • @TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

    – displayname
    Dec 29 '18 at 18:39











  • then try java -classpath server-1.0-SNAPSHOT.jar BOOT-INF.classes.company.server.Scheduler

    – Timothy Truckle
    Dec 29 '18 at 18:41











  • @TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

    – displayname
    Dec 29 '18 at 18:42











  • do you get the same error message still?

    – Timothy Truckle
    Dec 29 '18 at 18:44
















0















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.










share|improve this question

























  • is BOOT-INF/classes a folder inside the jar?

    – Timothy Truckle
    Dec 29 '18 at 18:38











  • @TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

    – displayname
    Dec 29 '18 at 18:39











  • then try java -classpath server-1.0-SNAPSHOT.jar BOOT-INF.classes.company.server.Scheduler

    – Timothy Truckle
    Dec 29 '18 at 18:41











  • @TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

    – displayname
    Dec 29 '18 at 18:42











  • do you get the same error message still?

    – Timothy Truckle
    Dec 29 '18 at 18:44














0












0








0








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.










share|improve this question
















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.







java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 19:11







displayname

















asked Dec 29 '18 at 18:28









displaynamedisplayname

6,5401679167




6,5401679167













  • is BOOT-INF/classes a folder inside the jar?

    – Timothy Truckle
    Dec 29 '18 at 18:38











  • @TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

    – displayname
    Dec 29 '18 at 18:39











  • then try java -classpath server-1.0-SNAPSHOT.jar BOOT-INF.classes.company.server.Scheduler

    – Timothy Truckle
    Dec 29 '18 at 18:41











  • @TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

    – displayname
    Dec 29 '18 at 18:42











  • do you get the same error message still?

    – Timothy Truckle
    Dec 29 '18 at 18:44



















  • is BOOT-INF/classes a folder inside the jar?

    – Timothy Truckle
    Dec 29 '18 at 18:38











  • @TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

    – displayname
    Dec 29 '18 at 18:39











  • then try java -classpath server-1.0-SNAPSHOT.jar BOOT-INF.classes.company.server.Scheduler

    – Timothy Truckle
    Dec 29 '18 at 18:41











  • @TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

    – displayname
    Dec 29 '18 at 18:42











  • do you get the same error message still?

    – Timothy Truckle
    Dec 29 '18 at 18:44

















is BOOT-INF/classes a folder inside the jar?

– Timothy Truckle
Dec 29 '18 at 18:38





is BOOT-INF/classes a folder inside the jar?

– Timothy Truckle
Dec 29 '18 at 18:38













@TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

– displayname
Dec 29 '18 at 18:39





@TimothyTruckle Yes. This jar file gets packaged by Spring which is moving all the compiled stuff into BOOT-INF/classes afaik.

– displayname
Dec 29 '18 at 18:39













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

– Timothy Truckle
Dec 29 '18 at 18:41





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

– Timothy Truckle
Dec 29 '18 at 18:41













@TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

– displayname
Dec 29 '18 at 18:42





@TimothyTruckle Just tried it. It does not work unfortunately. Could it be because BOOT-INF is not a vaild package name?

– displayname
Dec 29 '18 at 18:42













do you get the same error message still?

– Timothy Truckle
Dec 29 '18 at 18:44





do you get the same error message still?

– Timothy Truckle
Dec 29 '18 at 18:44












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972262%2frun-main-of-specific-class-inside-a-package-subdirectory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972262%2frun-main-of-specific-class-inside-a-package-subdirectory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'