Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

executable JAR file

Options
  • 30-04-2002 7:51pm
    #1
    Closed Accounts Posts: 8,478 ✭✭✭


    greetings

    how can i create an "exe" that can be double clicked from say, a users desktop to launch my application, made using JAVA

    I can make a JAR file, but that needs commands from the console to launch it ? need something that the novive [any myself ;] can use easily...

    ta


Comments

  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Two options spring to mind.

    1) Create an accompanying BAT file which contains the "console command" necessary to launch the app. You can actually do the same with a Windows shortcut, but I prefer BAT files personally.

    2) You can modify the windows file associations, so that JAR files get "launched" by java or javaw. Really neat, as long as you dont need any of the special switches with your app (in which case, its back to BAT land)

    jc


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Why do some people out there still insist that writing Windows exec's with Java is a good idea..?

    Give onto Caesar his own.


  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    What you want to do has been though of, by many before. I at one point asked people the same question. The answer is that it's possible to do, but remember the whole reason to code software in Java is to keep it portable.

    If you bundle some dependant shell to launch the program, you will in effect just be making the whole thing dependant on the platform. I notice a lot of people, who are still coding in Java, are thinking in Windows terms, and how they can make it easier to launch Java programs in windows. That's all well and good, you can code your batch file routines, that would have to find the users vm to launch the code, but that same batch file could not be used on a linux box (for example). Hence making your code platform dependant.

    just a thought

    ;-phobos-)


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    tbh this app is only gona be on a windows PC, ie the demo computer for my final year project.

    the easiest way for me to run the application without opening jbuilder the better

    ill try those tips tho bonkey, thanks


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Originally posted by phobos
    but remember the whole reason to code software in Java is to keep it portable.

    Not looking to start a philosophy war here, but the ability to write portable code is an advantage you can get with java, as opposed to being "the whole reason" for using java. There are very good reasons why it can, and should be ignored at times.

    jc


  • Advertisement
  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    as opposed to being "the whole reason" for using java

    Applogies!

    I didn't actually intend to come across like that. Portability is not the only reason, but it's a bloody good reason. Also when your are specifically targeting the Windows as your only target platform, you have many options open to you.

    Batch files being one

    also you might check out this program called INSTALL ANYWHERE
    http://www.zerog.com/releases/now/#windows

    It let's you deploy Java apps without having the end user worry about the intriciecies of locating their JVM etc.


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    PROBLEM

    tested JAR file and running it from JAVAW, works a treat :)

    BUT

    that was for an app without images. the final year project DOES use images. I took the same steps as the other JAR, but when I run it, all that appear are the Frame and Frame Title. None of the images / textfields etc appear.

    its a database app by the way.

    wat can I do ?


  • Closed Accounts Posts: 301 ✭✭Xian


    http://java.sun.com/products/jdk/1.2/runtime.html#example

    If you are using java 1.2 or higher you can do the following

    1. extract the jar

    >jar xf yourJar

    2. Modify the META-INF/MANIFEST.MF so that it includes the line

    Main-Class: <the class that contains the "main" method - note: no .class extension>

    3. repackage the jar using the m option to use your modified manifest file

    > jar cmf yourJar yourManifestFile *.class

    This should create a "clickable" jar file - platform independent (or so they say: works on OS X and Windows which is all I've tested so far)


Advertisement