How to run a jar file in Eclipse
You cannot directly execute a jar file. Instead, you need to run it using the java -jar
command. In order to do that you:
- Go to Run > External Tools > External tools Configurations
- Create an item under "Program"
Fill in:
Location:
/usr/bin/java
(or the route to your java executable, in Linux you can find this by runningwhich java
on a terminal, in Windows you can usewhere java
in command prompt)Working directory: The working directory for your jar program (usually its location)
Arguments:
-jar [path to your jar]
You could run the JAR with an "External Tool" launch configuration, found at Run > External Tools > External tools Configurations.
Run -> External Tools -> External Tools Configuration.
Program -> New