Running java application from batch file with correct jre

I have a very simple batch file that welcomes a Java (Saxon) application with a simple " java net.sf.Saxon.transform..."

This application requires Java version 1.5.

This batch file will be used by 400+ users who may or may not have some versions of the JRE installed on their machines.

I thought that just installing the latest version of the JRE will solve the problem, but no: in some cases in our preliminary tests, although the latest version of the JRE (1.6.0_13) is installed, the " java" command calls the old version of Java (1.3.1. ..).

What would be the easiest (but most reliable) way to do the following from a batch file:

  • check which of the latest installed jre
  • if latest version> = 1.5, use this JRE from command line
  • If not, tell the user to download the latest version of JRE

This should work even if there is no JRE installed on the machine.

I got a little familiar with Java Webstart, but I'm not sure if this is the easiest tool to work with. I could not figure out if it needed to be installed if it could be launched without any installed version of Java at all, etc.

What other tools for this?

+3
source share
1 answer

I never used it, but someone suggested Launch4j in another question .

+2
source

Source: https://habr.com/ru/post/1706397/


All Articles