wazz
wazz

Reputation: 780

Installing jre locally in windows app directory

I have a question about deploying windows application with java module.

I have windows application with several modules. One of these modules is written in java and is packaged as jar-archive. And if there's need for using this module, the application ask jre to start execute this jar. For this time during application installation it's initialized jre installation.

I would like to understand the following. Is it possible to install during application installation silently install jre in the application directory. So it jre copy could be used by the application.

I'm talking about structure like this:

/app
/app/jre
/app/modules/myModule.jar

So if it's needed to run myModule.jar I could do it with java from app/jre/bin ?

I saw something like that at Spark messenger (http://www.igniterealtime.org/projects/spark/). This application uses its own jre, which is installed at /Spark/jre/. But as I understand, this application is written in java and builded as a windows distributive using install4j.

I tried to find the answer to my question, but maybe I'm doing something wrong, I always find a solution of creating an exe-wrapper for jar file.

I would like to know about possibility to deploy application with installing jre locally in application folder.

Upvotes: 2

Views: 453

Answers (2)

JGreven
JGreven

Reputation: 33

In your /app/jre/bin folder there should be an executable binary called java. So in your folder /app/modules you can run

/app/jre/bin/java -jar myModule.jar

That should work.

Upvotes: 0

Devendra Bhatte
Devendra Bhatte

Reputation: 358

You could ideally have used Java Web Start in the past. Currently, you can use javapackager. https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javapackager.html

The javapackager command allows developers to create standalone native install bundles that do not require a separate JRE installation. The native options include: installer, image, exe, msi, dmg, rpm, and deb.

This is ideal for desktop applications, where the user may not have their own JRE installed and just wants the program to run. It may not be appropriate for server-based applications where an administrator would want full control over the environment.

https://blogs.oracle.com/java-platform-group/entry/java_web_start_in_or

Upvotes: 1

Related Questions