Wrapping Jar Files in Linux Executables?

I was wondering how to wrap my Jar file in a Linux Executable. I tried dowloading Launch4j, but that only allowed Windows Executables. Is there an easy way to do this? I'm trying need to be able to pass arguments to the Jar file.
Thanks!

And the arguments vary each time the user use your application ?
Then you will have to write a small shell script which takes the user input, e.g. myShellScript.sh var1 var2 ...
Inside the script you place the java -jar myProg call and pass the arguments to it:
cd /path/to/jar
java -jar myProg $1 $2
whereas $1 $2 ... holds the argument(s) which you have passed to myShellScript.sh.
To make it a little bit more comfortable you can define an alias for you myShellScript.sh so there is no need that myShellScript.sh is in /usr/bin,
Is it that what you are looking for?
Edited by: Michael_Knight on 17.11.2008 08:26
I just recognized that you use a debian package ... probably you can ignore my last hint.

Similar Messages

  • Starting a JAR File in Linux

    Hi,
    , to start a jar file in Linux from a file.. how can i do that?... like a .*bat file in windows, or a script file in unix...
    Thanks verry much, and sorry my english, (i'm form .UY :) )

    java -jar yourJar.jar should work for you. You could create an executable shell script to perform this or setup a file association to execute the file using java -jar whenever you bonk on it.

  • How to automount jAR file in Linux!

    hello,
    I am create JAR file. I want to put this JAR file in CD and if an user in linux platform can ablet to locate this JAR file in /usr/bin/myjar folder and open through java -jar jarFile.jar cmd using shell script. Is it possible to uto mount and auto run that JAR file in Linux.
    How can find whether JRE is already installed in a system or not.

    Hi,
    Is the Linux your client Platcform? If you want to execute something in the client, you need to use Webutil.
    You can use something like,
    You can use Client_Host from webutil to invoke an editor (say gedit for linux).
    HTH.
    Regards,
    Arun

  • Including a jar file inside an executable jar file

    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file? If so, how do you specify this in the classpath in the manifest?

    Russ_Bjork wrote:
    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file?No. Actually, I suppose it would be possible if you do all the 'heavy lifting', but Java is not designed to handle Jars within Jars.
    What do you see as the advantage of doing that?
    Is your app. a rich client (e.g. Swing, AWT, SWT..)?
    Can you distribute the app. from a server or the internet?

  • Executing JAR files on Linux

    Hi!!
    I make a little application and I want make the files who executes the jar file generated to allow user execute the program easily.
    In windows i make a .bat file that jost contains "javaw -jar <file.jar>".
    but how can i do to make the same in Linux?? what kind of script i must to do?
    Thanx!!
    PD: sorry my bad english!!

    You need to write a linux script, something like
    javaw -jar <file.jar>
    should do fine. Note, under linux the filename and its extension are not important. However you need to make the script executable e.g.
    chmod +x <script>                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Running .jar files in linux on double click

    Hi,
    i needed a solution to run the jar files on double click in linux system.Necessity is mainly because when i run the jar file by java -jar myapp.jar in terminal it works fine .Iam running my app continuosly in system tray(a server kind).But if i close the terminal my app exits.
    How to resolve this ?

    I am taking a SWAG.....it sounds like your problem is how to run a java app without a terminal window. So as I recall, there is some way in Linux to enter a command and have it execute in a new process. I don't recall the syntax but maybe putting a '&' character in the command line? Anyway, you should be able to use the method and use "javaw" instead of "java" to launch your app. You should be able to do this in a batch file too. Something like, javaw -jar yourjar.jar &

  • Jar file is not executing

    hi all,
    i was creating a jar excutable, when i was trying to execute it by double clicking on it(its placed in the desktop), open with dialog box is coming. could u plz help me out??
    here what i've done.. in the manifest file i've entered
    Manifest-Version: 1.0
    Main-Class: Class2Jarand to create the jar file i've given the command
    jar cmf manifest.mf max.jar Class2Jar.classthankx & regards,
    max

    open with dialog box is comingLooks like a broken file association. Try re-installing the Java runtime to have Jars associated to it again.

  • Error Running jar file on Linux Server

    Hi,
    I recently wrote a small program to be run together when apache is being start up on the server. When the bin/startup.sh is executed, my program will be run together
    exec java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
    I included this command in the startup.sh but the following error came up when I run it:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/btsoft/magic/zip/ZipFile
    I placed the jar file in the same directory as the startup.sh.
    But when I run it directly on the console:
    java -classpath ./ZipLogs.jar com.btsoft.magic.zip.ZipFile
    its fine..
    Can anyone help me with this problem?
    Thanks

    williammandrake wrote:
    I placed the jar file in the same directory as the startup.sh.That would suggest to me that your directory is wrong. I suggest you start by printing out cwd.
    Could also be a permissions problem as well.

  • Jar file won't execute

    I have written a program to manipulate an access database, it works fine from Eclipse but when I create a jar file using Jarbuilder 0.8, this jar file wont execute. It returns
    Exception in thread "main" java.io.IOException: invalid header field
    at java.util.jar.attributes.read(Unknown Source)
    at java.util.jar.Manifest.read(Unknown Source)
    at java.util.jar.Manifest.<init>(Unknown Source)
    at java.util.jar.Jarfile.getManifest(Unknown Source)
    The whole set of classes is online together with the database at users.skynet.be/NewOne/Televisie.rar (with Hoofdvenster as Manifest)
    and the jar file at
    users.skynet.be/NewOne/Televisie.jar
    I was wondering, do I have to include anything special because i m working with an ODBC here, or what else could be the problem ?
    All comments and suggestions are welcome, thnx in adance !!

    Hi there!
    After a brief look at your manifest a saw that you specifie the path to your main-class like this:
    Main-Class: gui/Gui
    ...and when you make the jar-file you type:
    jar cmf Manifest.txt JAppointment.jar Gui/*.class ...etc..
    Remember that Java is case-sensitive and look at "gui" and "Gui" differently!
    Maybee that could be the problem?
    /Andrew

  • Jar file doesn't execute correctly

    I have created a jar file both manually and using Eclipse. I seem to run into the same strange issue however.
    When I run the jar file from the command line, it executes some of the code, however, it doesn't seem to run any code in one of my classes. The program doesn't fail, however, and doesn't give me any exception.
    When I extracted the .class files in the .jar, my class is there. The decompiled code is also the same as I had written. When I execute the class file in the command prompt, everything works fine.
    Has anyone seen anything like this before?

    if you have problem to make a jar and you dosent understund what to do i have made a special program for you. in the beginning it was just for myself byt you lookslike you chould need it. www.tiinusen.hello.to/download/ just download jar converter there is a explanation/readme when you zip it up.

  • Deployment Profile Corrupts the jar file in Linux

    I am facing the follwing issue in the DROP 6 jdev.
    Have created a deployment profile which updates a jar file in <jdev>/extenstion directory. But whenever I try to execute it through jdev, the jar file is getting emptied. Any reason or workarounds for this issue?
    thanks
    Ramesh

    Please post DROP 6 issues on the Oracle internal discussion forums or to the jdev_us list

  • Jar files won't execute

    "Could not find the main class. Program will exit!"
    no matter what i put in the manifest, i keeps saying that,
    i've read everything i could find at jar files, and nothing works

    Have you put Main-class attribute in manifest file ?
    if yes, did you put a new line after this attribute ?

  • Deploying Java Desktop App using executable JAR files

    Hi there.
    Today I am very optimistic about java. I am a beginner, and I had tried (in my few free time) to understand how to deploy java desktop apps.
    I am using the lattest NetBeans IDE to do the programming and it is very very fast and optimized.
    Going to the point, I tried some time ago to deploy an application (made with this IDE) using JAR files, but even though the application run well on my IDE, when I packed it, it rised an error saying that
    java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
    I was using an absolute layout on my JFrame forms and this AbsoluteLayout is provided by netbeans and not by the normal SDK.
    I then looked for the absolute layout class and found a jar file in the following path:
    C:\netbeans\modules\ext\AbsoluteLayout.jar
    So I mounted the Jar file in my File Systems and then added the contents of the file to myApp.Jar file.
    I used the automated Jar Recipe Packaging feature of netbeans, that is why I needed to mount the AbsoluteLayout.jar file into my file systems.
    Now it runs fine by just right clicking the MyApp.jar file from Windows Explorer.
    In a next reply to this topic I will include some sample code so that anybody requiring to do such implementation can take this for help.
    Regards!
    JN

    Well,
    I will take some time here to show the basic source code and procedure to create a desktop application, pack it up in a Jar file for deployment, add other classes or jars to the deployment jar file and finally open the jar file as an executable. This applies for either windows and linux environments.
    Take in count i am using Netbeans IDE 3.x (3.5)
    First I open the IDE and create a new project called MyDesktopApp. This is done by going to the menu Project / Project Manager. Then click on the New button and specify the project name and click on OK.
    At this point, the Filesystems tab in the project explorer is empty. So I mount a directory to store myDesktopApp in it. I selected c:\MyDesktopApp but you can select any name you want.
    To mount the directory you follow these steps:
    1. Right-click on File Systems
    2. From the contextual menu select Mount > Local Directory
    3. In the filechooser window, you just browse it and SELECT the directory to mount. Be aware that you can even create the directory on this window. Do not enter (double-click) into the directory you want to mount, just select it and click on finish...
    4.Then the directory entry appears under the filesystems node of the project explorer.
    Now you have to create your application. You can either create a package (special configured and tracked directory) or you can create the clases directly inside the directory. For tidy project, I will create the package.
    To create the package follow these instructions:
    1. Right-click on the mounted directory and from the contextual menu select New > Java Package
    2. In the New Wizard - Java Package window, type the package name and click on finish. I use the "MyDesktopApp" as package name.
    OK. Now the package is created under the mounted directory. Now we have to create the Main Class. In this case I will use a JFRAME as the main class but you can create any class you want.
    To create the JFRAME as main class follow these steps:
    1. Right click on the java package you just created and select New>JFRAME from the contextual menu. If you do not see the JFRAME option on the NEW sub menu you will have to select the All Templates option. I explain the All Templates option now on, it will be easier to use the JFRAME if available. Once you use JFRAME with the all templates then the JFRAME will show up in further NEW usage.
    2. So finally we used the All Templates, and you select the Java GUI Forms > JFRAME form option and click on NEXT.
    3. Give it a name. (I used MyDesktopAppFrm) and click on finish. Be aware you can set advanced options by clicking on next. But for the purposes of this topic we will use default options so click on FINISH
    4. A new JFRAME form appears inside your package. Right click on the form and select Set layout > Absolute Layout.
    5. Add some controls and code. I added a label and a button. And coded the ActionPerformed event of the button to say hello! on the label. this is up to you. The code just looks as follows:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // Add your handling code here:
    jLabel1.setText("Hello folks!");
    6. Compile and execute the form.
    Let's say this is our Desktop Application. Now We will pack it in a Jar in two steps...
    A. Create a JAR file (Recipe)
    1. Right-click on your package and select New > All Tempaltes (Long Route) You can also select New > JAR Recipe if available.
    2. On the New Wizard Window, choose the JAR ARchives > JAR Recipe template and click on NEXT
    3. I used MyDesktopApp as the file name and Defaults and then click on Next.
    4. Specify the JAR Contents. Select the Package (not the mounted folder) from the mounted file system and click on add and then click on NEXT twice...
    5. On the JAR Manifest window, click on GENERATE
    6. Edit the manifest in the window to add the following code:
    Main-Class: MyDesktopApp.MyDesktopAppFrm
    7. Ensure the Main-Class definition is the same as your java package and JFRAME name. Click on FINISH
    8. At this point we have a jar file in your project directory but this file wont run because it is missing some Netbeans clases that we will add in the next set of steps... Just to check, compile the file (right click on the JAR file and compile) and try to execute. It must compile but must not execute.(well if it executes you are done. It may execute if you did not set the lay out of the form as AbsoluteLayout)
    B. Add the AbsoluteLayOut to the JAR
    1. Right click on File Systems and select Mount > Archive Files
    2. Look for your netbeans installation folder and select the following file:
    .../netbeans/modules/ext/AbsoluteLayout.jar
    3. Click on finish
    4. Now the JAR File is mounted in the file systems.
    5. Right-click on your MyDesktopApp.JAR file and select properties.
    6. Look for the contents property click once on it and then on its elipsis button [...]
    7. From the FileSystems box in the Contents window, select the AbsoluteLayOut file and click on Add
    8. Then the system asks you if you are sure. Of course you are so click OK. (If not sure, just read the message text and click OK...:-))
    9. Click on OK
    10. Compile your JAR Recipe (right click on it and Compile)
    11. Now you must be able to run the file by right clicking it and EXECUTE.
    12. Also you must be able to run the file by double clicking the file from a Windows Explorer. You may receive a message asking to select the program to run the file with. You must browse and select the Javaw.exe file in the bin directory of your Java RUn Time installation. This is typically located at C:\j2sdk1.4.0_01\jre\bin or something like that. Use the File-Search feature of window to locate the JAVAW.exe file if needed.
    I hope this long explanation helps somebody to deploy Java Desktop applications. Please reply the message if it helps you just to know it was useful.
    Thanks for your time....
    JN

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

  • Why -jar option used to install a software which is in executable jar file?

    Hi all,
    i have a query, i have a generic installer which is used to install the oracle weblogic 10.3 software in unix platform(i.e., which is in .jar extension) which is executable jar file.
    To install this software which have to use -jar option to install
    java -jar net_server<version>_generic.jar
    my question that why we use -jar option to install or to extract the software
    can any one clarify my doubt...
    thanks in advance
    abhi
    Edited by: sumanth_abhi on Jan 27, 2009 11:50 PM

    According to the Jar Guide (http://java.sun.com/j2se/1.4.2/docs/guide/jar/jarGuide.html)
    Executable Jar Files
    On Microsoft Windows systems, the Java 2 Runtime Environment's installation program will register a default association for Jar files so that double-clicking a Jar file on the desktop will automatically run it with javaw -jar. Dependent extensions bundled with the application will also be loaded automatically. This feature makes the end-user runtime environment easier to use on Microsoft Windows systems.
    The Solaris 2.6 kernel has already been extended to recognize the special "magic" number that identifies a Jar file, and to invoke java -jar on such a Jar file as if it were a native Solaris executable. A application packaged in a Jar file can thus be executed directly from the command line or by clicking an icon on the CDE desktop.
    Despite that every JAR file can be executed as a program if and only if the META-INF/Manifest.mf contains the Main-Class tag. This done through java -jar jarfile.jar
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for