'Execute a JAR file in a specific JRE

I have been looking at this question and although it shows how you can execute a jar in Windows, it does not show how this can be done in Linux (preferably CentOS). How can I execute the .jar file I made in Linux?

Here is what I have on the command line:

[support@turndownForWhat project]$ ls
DICOMFLOW.jar  jre1.7.0_60

UPDATE: I have tried this:

[support@turndownForWhat project]$ sudo jre1.7.0_60/bin/java -jar DICOMFLOW.jar
[sudo] password for support:
sudo: jre1.7.0_60/bin/java: command not found

I ran:

[root@turndownForWhat project]# ls -l jre1.7.0_60/bin/java
-rw-rw-r-- 1 support support 5718 Apr 17  2014 jre1.7.0_60/bin/java


Solution 1:[1]

Based on your reported output, the java command is not executable. This is likely an issue with the copying or uncompressing of the JRE directory.

Solution 2:[2]

It's pretty much the same, just without the .exe:

<path_to_jre>/bin/java -jar Executable.jar

Solution 3:[3]

It's the same as executing in Windows:

<path to bin folder for the specific JRE>/java  -jar Executable.jar

Make sure you can ls to the directory with the same path.

Solution 4:[4]

It does not matter whether the JAR file was created on Linux or Windows or is to be executed on Mac. That's why it is called portable.

Just use the java -jar command with the specific JRE you want to use (add the path of the bin folder or create an alias ans use something like java7 -jar ...).

Solution 5:[5]

"C:\Program Files\Java\jdk-11.0.15\bin\java" -jar jenkins.war

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 martinez314
Solution 2 that other guy
Solution 3 Peter Mortensen
Solution 4 Peter Mortensen
Solution 5 sajeeth