3

I have standalone web application, uses embedded Tomcat, MVC Spring boot.

How can I wrap it correctly into .exe, not to let final user modify property file.

The executable war,created with Maven 'mvn clean install' works just fine while launching from cmd.

I tried Launch4j, works well , generates exe file successfully with all in that but when I execute. I get this error.

Well, I tried error handling but it does not solve my issue.

Error :

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Apr 07 16:04:11 CEST 2016 There was an unexpected error (type=Not Found, status=404). /view/home.jsp

Dave D.
  • 737
  • 3
  • 10
  • 23
  • I doubt it will work as an `.exe` I suspect that will break the custom `JarLauncher` not being able to read the content anymore. Also creating an exe doesn't solve that problem, it can still be extracted (the war) which in turn can be extracted to. It will only add a layer of indirection. – M. Deinum Apr 07 '16 at 18:10
  • Try creating a executable `jar` instead of `war` and make sure it runs without this error. You need to move all of your static files into `src/main/resources/static` folder for `jar` to work. Lets see if that works :) – Sanjay Rawat Apr 07 '16 at 20:54
  • Thanks guys I will test and update the progress. – Dave D. Apr 08 '16 at 07:34
  • @DaveD. Did you get it to work? I am facing a similar problem with an executable jar. It works fine when launched from a command line with `java -jar .. ` However both the executable jar and the exe shows the "Whitelabel Error Page" when launched by double clicking. So it has to be the way the jar is launched. Just could not see where the problem is. – Ashok Jun 06 '16 at 04:53
  • @Ashok sorry for the late reply, it seem that assembly mechanism of eclipse is not the same as Launch4j. In generated exe the client package (.jsp) were missing so I dropped the idea. – Dave D. Jul 13 '16 at 13:07
  • @Dave Thanks for the response. I am still sticking on to the idea of exe generation with Launch4J. I am not sure how you verified that the .jsp files were missing. Currently I am able to run the application with executable jar and also with the exe. So I have all the jsp files in the exe. – Ashok Jul 14 '16 at 10:12
  • @Dave The whitelabel error page is shown only when it is launched from the same directory (`java -jar x.jar` in command prompt) or by double clicking. However, it runs just fine when I launch the exe or the jar from a parent directory (`java -jar target\x.jar` or `target\x.exe`) So I am wondering what could be causing this.. just my 2 cents.. – Ashok Jul 14 '16 at 10:20

1 Answers1

0

First as it is Spring Boot app do convert it into .jar packaging (that will have embedded Tomcat).

Then the question would become how to create installer for Java app or bundle JRE together with Java app

Whitelabel Error Page

is just application error, not related to main question ("How to wrap executable .war with embedded tomcat into .exe?")

Paul Verest
  • 60,022
  • 51
  • 208
  • 332