ryekayo
ryekayo

Reputation: 2431

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

Upvotes: 5

Views: 14896

Answers (5)

sajeeth
sajeeth

Reputation: 77

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

Upvotes: 0

Dici
Dici

Reputation: 25980

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 ...).

Upvotes: 1

Chiseled
Chiseled

Reputation: 2300

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.

Upvotes: 1

martinez314
martinez314

Reputation: 12332

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.

Upvotes: 3

that other guy
that other guy

Reputation: 123610

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

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

Upvotes: 4

Related Questions