We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

nufar
Posts: 1
Joined: Wed Dec 27, 2017 2:13 pm

Running jar as a service - Could not find or load main class error

We have a jar that contains the following:
1. META-INF with manifest
2.BOOT-INF with the following folders:
2.1 classes (all our code is under this folder)
2.2 lib
3. org

The manifest file looks like:
Manifest-Version: 1.0
Start-Class: com.x.y.Main
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Version: 1.0.0-local-DEV
Spring-Boot-Version: 1.5.7.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher

We have a second main class that responsible for start and stop the service as requested by you: com.x.Bootstrap (extends JarLauncher).

We defined a new java product with main class : com.x.Bootstrap

When running the installer we got the following exception:
Error: Could not find or load main class com.x.Bootstrap

The main class is in BOOT-INF\classes\com\x\Bootstrap inside the jar.
What need to be defined in the Main class in this case case?

*Notice that under the BOOT-INF\lib and org we have all the dependencies jars
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Running jar as a service - Could not find or load main class error

Hello Nufar and welcome to our forums,

I cannot say why this happens. Could you please send us the .aip (project file) and a link to download the built setup package to support at advancedinstaller dot com so we can investigate and test its settings?

If you cannot disclose your setup project you can try to replicate the error into a small sample and send it t us to investigate this.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”