Running a JAR file without directly calling `java`

HalfBrian :

I am deploying a command-line tool that is written in Java that accepts command-line arguments. I have it packaged as a JAR file because it is convenient to have a single file.

The problem is that to run it you must first call java -jar (filename) (args) and that is quite annoying.

The current way I have it is to have a simple bash script that launches it, but this is less than ideal.

Is there anyway (in Linux, Ubuntu Server) to make a JAR file that invokes the Java VM by itself? I've looked for a shebang, but couldn't find one (which of course makes sense since it is compiled code).

This is what I want to do: myprogram.jar arg1 -arg2 instead of this: java -jar myprogram.jar arg1 -arg2

Thanks,
Brian

Ken Bloom :

See Documentation/java.txt in the Linux Kernel documentation, which tells you how to configure a system using the binfmt_misc kernel module to run Jar files automatically. However, this is a configuration option you change on a computer, not something you change about the jar file, so it doesn't follow the jar file from system to system.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java jar file not running

From Dev

Java problem - java, Jar file Statmetrics is not running

From Java

Java - How to replace a running jar file

From Dev

Test if application is running in a jar file in Java

From Dev

Running a java -jar command from a batch file

From Dev

Is there any way to run a .jar file directly from a java Unix executable?

From Dev

Java properties file in jar not found when running jar

From Dev

to include dll file in java without jar files

From Dev

Logging is not working from exe created with jpackage, but works when running the jar file directly

From Dev

Java get path of executing jar without .jar file

From Dev

is there any way to run java .jar command without downloading the jar file?

From Java

How to convert a .java or a .jar file into a Linux executable file ( without a .jar extension, which means it's not a .jar file )

From Java

Java - directly reading a file without downloading and storing locally

From Dev

Running Cucumber tests directly from executable jar

From Dev

Calling Java JAR functions

From Java

Running JAR file on Windows

From Dev

Creating a custom constructor without directly calling inherited

From Dev

Constructing a class in python without directly calling the constructor

From Java

Running a Java program from the command line that depends on a jar file?

From Java

Running java from its built Jar file (the alternative way)

From Java

Running java from its built Jar file (the alternative way)

From Java

Running java runnable JAR

From Dev

How to see Java executable jar file now running and stop jar file from GUI or notification window?

From Java

Running Java Security Manager without the default java.policy file

From Dev

Running an executable by calling it in a .sh file

From Dev

Importing .jar file directly via filepath at runtime

From Dev

How to load external properties file with Java without rebuilding the Jar?

From Dev

How do I run a JAR file without installing Java?

From Dev

How to create jar file without java classes but with a folder using maven

Related Related

  1. 1

    Java jar file not running

  2. 2

    Java problem - java, Jar file Statmetrics is not running

  3. 3

    Java - How to replace a running jar file

  4. 4

    Test if application is running in a jar file in Java

  5. 5

    Running a java -jar command from a batch file

  6. 6

    Is there any way to run a .jar file directly from a java Unix executable?

  7. 7

    Java properties file in jar not found when running jar

  8. 8

    to include dll file in java without jar files

  9. 9

    Logging is not working from exe created with jpackage, but works when running the jar file directly

  10. 10

    Java get path of executing jar without .jar file

  11. 11

    is there any way to run java .jar command without downloading the jar file?

  12. 12

    How to convert a .java or a .jar file into a Linux executable file ( without a .jar extension, which means it's not a .jar file )

  13. 13

    Java - directly reading a file without downloading and storing locally

  14. 14

    Running Cucumber tests directly from executable jar

  15. 15

    Calling Java JAR functions

  16. 16

    Running JAR file on Windows

  17. 17

    Creating a custom constructor without directly calling inherited

  18. 18

    Constructing a class in python without directly calling the constructor

  19. 19

    Running a Java program from the command line that depends on a jar file?

  20. 20

    Running java from its built Jar file (the alternative way)

  21. 21

    Running java from its built Jar file (the alternative way)

  22. 22

    Running java runnable JAR

  23. 23

    How to see Java executable jar file now running and stop jar file from GUI or notification window?

  24. 24

    Running Java Security Manager without the default java.policy file

  25. 25

    Running an executable by calling it in a .sh file

  26. 26

    Importing .jar file directly via filepath at runtime

  27. 27

    How to load external properties file with Java without rebuilding the Jar?

  28. 28

    How do I run a JAR file without installing Java?

  29. 29

    How to create jar file without java classes but with a folder using maven

HotTag

Archive