Automatic launch of .jar files

how to configure Java to automatically launch .jar files on double click in Windows and single click in Linux

Windows should be set up to run jar files when you install a JRE or JDK. I don't know about Linux. If it doesn't happen automatically, you must tell the OS that when you click a jar file, it should launch the jvm with the parameter "-jar [filename]".
To make your jar files executable, include a parameter called "Main-Class" in the manifest file, containing the name of the main class of your application. So if your main class (the one with the main-method) is called mypackage.myapplication.MyMain.class, the manifest file should have the entry    Main-Class : mypackage.myapplication.MyMain

Similar Messages

  • Preventing user launch of .jar files

    With Workgroup Manager I can prevent users from launching certain applications. What I cannot do, however, is prevent users from launching certain .jar files. Is there any way to prevent Jar Launcher from launching files like oh, let's say, OurTunes?
    17 Powerbook - 1.5Ghz   Mac OS X (10.4.6)   2GB RAM, Adobe CS2, Xcode 2.3

    Windows should be set up to run jar files when you install a JRE or JDK. I don't know about Linux. If it doesn't happen automatically, you must tell the OS that when you click a jar file, it should launch the jvm with the parameter "-jar [filename]".
    To make your jar files executable, include a parameter called "Main-Class" in the manifest file, containing the name of the main class of your application. So if your main class (the one with the main-method) is called mypackage.myapplication.MyMain.class, the manifest file should have the entry    Main-Class : mypackage.myapplication.MyMain

  • Launching a JAR file

    I am distributing my java application as a JAR file. The target OS is Windows. Before launching the application each time, I need to set some system variables. For this purpose I am using a batch file.
    When the application is launched, two windows open.
    1.Main application window
    2. Console window.
    I want to hide the Console window. How can I do this?

    But I want to launch a jar file directly instead of
    using the batch fileUse javaw.exe
    and also to set some system
    variables before launching it.Use a batch.

  • Java could not launch java jar file

    im trying to install this jar file and every file sunce i updated it has not work and even befor soe where not workingi went to terminal and di java -version
    it said i was running 1.6.0_65 but yet it says i dont net to update but i have an very old macbook pro like 2010 2009 please help im

    Dear Patel,
    Thanks a lot for the reply!
    It would be very nice...if you could tell me the siteminder directory, where I can find this jar file...I searched a lot but could not find this jar file.
    if possible for you, please send me the jar file on my mail id:
    [email protected]
    Regards,
    Qumar

  • Passing -Xms -Xmx argument when launching a Jar file

    Hi
    My Java app is memory hungry and, so far, I have to start it with
    java -Xmx256m -jar myApp.jar
    I'm wondering if it's possible to embed "-Xms256m" into this .jar file
    so that I can simply start it by double-clicking on the myApp.jar file.
    Thanks
    Hui :)

    Well i had the same problem, and since now all answers i found were negative. A (not so good, but working) solution (at least for my needs)is here: http://forum.java.sun.com/thread.jsp?forum=54&thread=307731&start=0&range=30#1229424
    Any better solution (i am sure there is a lot) is wellcome...

  • Automate launching a DMG file

    Hi,
    I posted this question in another forum and it was suggested that I try this forum.
    Desired functionality: Insert USB flash drive into USB port and launch an encrypted DMG file so that it mounts (on machines where the password is saved in the keychain) and is ready to use along with the flash drive.
    I have never used automator, so I would be greatful for as much detail as possible about what i should do.
    Thanks.

    Sure thing, although this might take a moment or two to setup once you do there will be no more effort required.
    The AppleScript you will need to use is:
    repeat
    try
    do shell script "hdiutil mount '/Users/richard/Desktop/My Flash Drive/encrypted.dmg'"
    on error
    (* Do nothing. *)
    end try
    end repeat
    The addition of the repeat means that this script will loop in the background only to take effect once the disk image becomes available.
    Here's what to do:
    1) Copy this AppleScript into the Script Editor.
    2) File > Save As... > Change 'File Format' to 'application bundle', and uncheck 'Run Only' and 'Startup Screen', and then check 'Stay Open'. > Save the file somewhere that you can keep it.
    3) Quit the Script Editor.
    4) Navigate to the folder in which you saved your script application bundle, and ctrl+click (right click) it. Choose 'Show Package Contents'.
    5) In the Contents folder, there will be a file called Info.plist. Open this file using TextEdit.
    6) Scroll to the very bottom of the document, and create a new line above:
    </dict>
    </plist>
    7) Paste on to the new line:
    <key>LSUIElement</key>
    <true/>
    8) Save this file, and quit TextEdit.
    9) Reboot your Mac (this step is essential!).
    10) Open System Preferences, navigate to Accounts, select 'Login Items', and then click the + button. Select the script application bundle.
    Done! Restart your Mac (again!) for the script to come into effect. Steps 4, 5, 6, 7, 8 and 9 are all to do with making the script not appear in the Dock when it's running, but if you don't mind seeing the icon constantly you can skip these steps.
    This should pretty much work, but there's the slim chance I got something wrong so if this doesn't behave how you expect it to let me know and I'll figure out a fix.
    All the best, hope I solved your question.

  • How to launch Jar file in Mac Os using java code??

    can anyone tell me how can i launch another jar file in my apllication using java code.

    define "launch".
    - You want to run a new java program in a separate process? (see Runtime.exec())
    - You want to run a method in a specific class in the jar? (add jar to application classpath and then simply instantiate the class and call the method)

  • While executing a jar file I am getting an error

    while exec a jar file i am getting an error
    invalid file (bad magic number): Exec format error
    i tried to execute it with the commnad
    java -jar test.jar
    or by directly too
    ./test.jar

    Than tell me how to launch a jar file I tried different ways like
    java -jar MyJar.jar
    and
    MyJar
    and
    ./MyJar
    but its not worked

  • Add jar file to forms application standard java library

    Overall Problem
    I created a jar file using JDeveloper to be loaded as a bean in forms builder. But the jar file ended up being really large because I had to add some standard libraries that JDeveloper knew about but Forms didn't to this jar file, it takes forever to load in my forms application.
    Background
    Jdeveloper has a drop down list of standard libraries that aren't commonly used that a developer can have included/referenced into their java project.
    Oracle Forms Library
    One of the standard libraries in JDeveloper that can be referenced when compiling a project is the Oracle Forms library. I have to reference this library in my compilation of my java project in JDeveloper because some of the java code in this project requires the Oracle Forms library. When the jar file is created in JDeveloper the Oracle Forms Library isn't actuaally physically located anywhere in the jar file that is produced for deployment. But the jar file runs perfectly in my forms application. Forms builder and the forms application server seems to already know about the Oracle Forms library.
    Java Media Framework Library
    There is another standard library listed in JDevelopers drop down list that I recently chose to use in my Java Application, the Java Media Framework library. But my forms application couldn't find any of the Java Media Framework classes when it launched the jar file that was deployed from JDeveloper. Obviously the classes wern't physically located in the jar file I created, because I figured that the forms application server/forms builder would already know about about this standard library that JDeveloper knew about.
    Not very effective Solution
    So I physically put/included the whole Java Media Framework Library into my jar file and then my form launched fine. But it now takes forever to load. How can I add the Java Media Frame work library jar files as one of the standard libraries that the forms builder and application server already sees (Like the Oracle Forms Library) without having to put the library in the forms/java folder and wait for the this jar file to download to the user's cache?
    Side note: The Java Media Framework Library is allowing the ability to launch video from my form. Very useful tool!!! So it would be good if forms had this already added as a standard library like it is in JDeveloper. But I only see the ability to reference this library in DS 10gR2 for JDeveloper.
    Thanks,
    Michelle

    Yes I have successfully been able to run a javabean application that uses the Java Media Framework methods within a forms module. The video seems to play and interact normally in the forms environment (launched from a DS or the AS).
    Basic Requirements
    Develop the java application functionality look and feel, including adding funtionality calls to the JMF library where needed.
    Develop an Oracle Forms Interface wrapper that will be the initial class called from the bean area, to hande any communication between the bean and the form.
    Configure the deployment of the jar to physically include all the needed classes from the JMF library.
    Sign the jar file and make sure it is placed in the forms/java folder and referenced in the appropriate forms configuration files.
    Depending on the type of video that the will be played certain .dll files might need to be added to the users system folder. Using H264 (.mov) should work fine without any extra .dlls.
    Thanks,
    Michelle
    Message was edited by:
    mpoore

  • .jar files Please help

    Good day all.
    I am very new to java and admittedly not a very technologically savvy person. However, I play the card game "Magic: The Gathering"? and wish to play online because not any of my friends play. I use a macintosh computer. I researched Magic Online and found you could download a free trial from Wizards of the Coast Website, but it was not for Macs. I continued to research and found something called "WebWizard" a program allowing Mac users to play Magic Online. I downloaded the necessary files and attempted to install them. The two files were named 'ww.jar' and 'cards.jar'. When I opened 'ww.jar' it said "Jar Launcher: The jar file "ww.jar" couldn't be launched. Check the Console for possible error messages". I opened 'cards.jar' and received the same message. Using what little intelligence I have in regard to Java, I opened a search for anything related to it, and found the Java Web Start application. I started up the application and followed the instructions, and was asked to locate the files I wanted to view. I located the first, 'ww.jar', and it opened a page full of what I assume was programming language that had been translated into what the symbols would be on my computer - Total gibberish. I opened the 'ww.jar' once again and the error message did not appear. Instead, the WebWizard window started up!
    However, I needed to get the 'cards.jar' file to work so I could start playing Magic Online. I tried to do the same thing with Java Web Start, but 'cards.jar' failed to open when I located it. I tried opening the file anyways, but nothing happened.
    I have worked for about an hour on trying to get this to work, and have not found any way. Please help me out!

    If you just want to play casually, you can use Magic Workstation. It's free, but it won't let you play with other people on Magic Online, but I think it does have some tournaments of its own (but not for prizes). Another older piece of software that isn't used as much anymore is Apprentice. I don't know if either of these run on a Mac.
    Depending on what version of Mac you're using (and if you have a PowerPC processor), you might be able to use Virtual PC (which costs money) to install a Windows image on your computer, and then virtually run Magic Online (if you obtain the Windows image from a file sharing network instead of purchasing Windows legitimately, this is illegal).
    You could also try using VMware Player (which is free software) to run Windows virtually on your computer and play Magic Online that way. I'm not sure if VMware runs on a Mac though.
    Please don't try all of these things until something works; this will be very time consuming. Give us some more background on where the Jar files came from and, if you can, the error messages printed to the Java console. Also, how much do you know about computers? If you know how to compile source code that will probably increase your options since I believe the source code for VMWare Player is available.

  • Launch a specific file on startup

    Hello everyone,
    Is there a way to automatically launch a specific file on startup?
    I would like to have an image pop up on my wife's computer when she logs in in the morning. Is this possible? Is there an app to automate this sort of thing? I've looked into the Login Items, but as far as I know it only allows one to launch apps, not specific files.
    Thank you so much for your help
    Best,
    Rui

    Hi there,
    Thank you for your help. I just found the answer in another post, and you can actually fo it from the Login Items section. Simply click the + sign, select the file to open and voilá
    Cheers!

  • Jar file !

    Hallo,
    I want that the jar file executes the program when you click on the icon.
    The program is executed by DOS.
    And I must include a package (javagently) to the jar file.
    How can I do that?

    I don't think there's a way to do that when the program is in a package.
    Sorry. I was going to tell you to create a batch file to launch the jar. But that would work when a package is involved.
    Oh wait, I just had an idea.
    if you created the jar file using the Main-Class attribute in the manifest, such as
    Main-Class: javagently/Main.class     (not sure about the syntax, maybe the .class isn't there).
    Then when you click on the jar, use the 'open with...' dialog to type in
    java -jar %1
    that would launch the jar file (no parameters can be passed this way though).

  • [J2ME] How to launch a .jar or .class with IM profile

    Hi all,
    I have tried and succeded to launch a .jar file with J2SE but with J2ME IM profile, I couldn't manage do the same because the URLClassLoader is missing.
    Does someone knows how to do that ?
    Thanks,

    I confirm your findings when using shortcuts to try specific versions of JavaWS with 7u25 or later installed:
    JRE 5u14 launched and the classloader was as pre 7u25
    JRE 6u43 would not launch
    JRE 7u21 launched but the classloader was not as pre 7u25
    You can launch the shortcut with the JavaWS -verbose option to display a messagebox with valuable information.
    I am keeping a close watch on this thread.

  • Getting application path when launching a Jar

    Hi,
    very simple
    how do you get the application path when launching a jar file?
    NNiol

    Unless you mean the standard application folder. That application path is an OS specific concept. On Windows systems, for example, you can get the application path by using System.getenv("ProgramFiles"); but that won't work on other systems.
    If you're looking for a constant location to store data files, you'd do better to create an application-specific directory under System.getProperty("user.home");.
    And if you're just looking for the place where your jar file is, you can successfully follow the previously given advice.
    --DNP                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • On *.jar file

    hello to everyone! i hope you can help me on this, i need to launch a *.jar file on my java application, is there anybody who could help me on this? I know how to use the runtime.exec but I don't know what am I going to put inside this function...
    runtime.exec(new String[] { "rundll32", "url.dll,FileProtocolHandler",
              name} ); (uhm yes this is for launching *.exe files I don't know what am i going to put inside the parenthesis of runtime.exec)
    thank you very much!

    You can change the icon for any type of file in windows. Java '.jar' files are no exception. By default jar files have a stupid icon that looks like a wordpad document (I think). I now use an icon of a coffee cup.
    Follow the second part of this document:
    http://www.adobe.com/support/techdocs/ac22.htm
    basically: In Windows Explorer. 
      From Menubar: Tools->Folder Options
      Goto "File Types" tab
      Find and select 'JAR' file in list
      Click 'Advanced' button. (DON'T click 'Change...' since that will
        try to change which application (javaw) is used to open jar files!
      In the resulting window, click the 'Change Icon...' button.  Select
        the icon of your choice.  Icons can be found in.
            .exe files will often have a list of icons embedded within them
            .dll files will also often have several
            .ico (windows icon files) include one or more
            and maybe you can use jpg or gif or other image format directly
               I don't know.Getting to the right dialog is slightly different depending on your version of windows. Read the article for more details.
    ...Chad

Maybe you are looking for

  • My Apple TV is a useless brick now.  Ethernet port no longer works.

    Not sure, but it seems after an update, my ethernet port does not work.  I can plug it into the PS3 and works fine.  I HAVE TO use WiFi now or my Apple TV is a useless piece of plastic that looks "oh so Apple Cool."  Yea, whatever Apple.  I have been

  • Really slow disk access

    our iMac runs like a dog. I've max'd RAM, cleaned and optimized the hard drive. Configured with two non-admin users (myself & my wife - I need right-click but it drives here crazy), and an admin account. iTunes and iPhoto libraries are shared, and th

  • Album Artwork won't display correctly.

    I've been having this issue for a few months now. My music doesn't have the right cover art on my Ipod touch 4 (running 6.1.6) but it displays correctly on iTunes 11.1.4 for PC. What happens is cover art for other music that i own will be on albums t

  • ODT Package Load Failure

    I am running VS.NET 2005 SP1 on XP Pro SP2 and I have Oracle 10gR2 installed on this box. I downloed and installed ODT beta in my 10gR2 Home. Now I ge the following: Package 'Oracle Developer Tools for Visual Studio .NET' has failed to load properly

  • Problem installing flash - Matlab tries to open it

    I've succeeded to download the installer but when I click on it to run Matlab tries to open it... got a Mac OSX 10.6.8 and Safari 5.1.10