• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How do I run .JAR files in Linux?

LastStop

Senior member
I've downloaded the latest JRE from java.sun.com and it still doesn't work. I'm new to Linux so please don't laugh🙂. BTW I'm using RedHat 7.3 if that helps.
 
Originally posted by: LastStop
I've downloaded the latest JRE from java.sun.com and it still doesn't work. I'm new to Linux so please don't laugh🙂. BTW I'm using RedHat 7.3 if that helps.

I take it you tried running:

java <filename.jar> ?
 
Originally posted by: Vortex

I take it you tried running:

java <filename.jar> ?
That's not correct.

First off, correctly install the Java2 SDK (or JRE) and verify by running the command:
java -version

If that works, and the .JAR file was setup to support easy running (most are not), then you can run it with the command:
java -jar SomeApplication.jar

The reason most applications aren't set up to execute this way is because they usually rely on a bunch of JARs (which are basically a collection of components, or a module), often from disparate sources. So most Java applications are started via a script. Kinda kludgy compared to SomeApplication.exe but that's partly why Java is not strong on the client side.
 
Silly me I guess you have to add the bin folder to the PATH directory just like windows. But I thought that was automatic when it was installed. Which configuration file do I add the PATH line instead of using 'export' command each time I start a terminal?
 
In your .bashrc file in your home directory, edit the "set path={stuff}" to include the path to where you installed java, just follow the format of the existing path, can't really remember in linux bash, but I know in Sun Solaris (and in csh, not bash) its just a space seperated list of directories that you want it to look though to find your command, it is also important to note that it will search through those directories in the order in which you specify them in that line, so if you have /dir1 and /dir2, both with the command runme.exe in them, and the path is "set path={/dir1 /dir2}" and you type runme.exe, "/dir1/runme.exe" will be the one which is run (this tends to be helpful information for people who can't seem to figure out why the wrong command is being run when there are multiple things of the exact same name in the directories in their path). Hope this helps you.
 
Back
Top