Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Jar Versioning with Eclipse

  1. #1
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Question Jar Versioning with Eclipse

    Hey guys,

    My ultimate goal is to configure Java Webstart to download the newest version of a Jar instead of using the cached one. I'm pretty sure this is as simple as including a version number in the Jar's manifest.

    My question is, how do I do that with Eclipse? I usually just do File > Export > Runnable Jar, and that has worked in the past (including with webstart, but without version updates). I can't find anywhere in the project properties window or in the export window to specify a version, but that seems like a pretty obvious thing to specify.

    Any ideas?

    Thanks in advance,

    KevinWorkman
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Jar Versioning with Eclipse

    Do you mean something like the version control defined within the jnlp spec? Check out the following page to see if versioning in the JNLP might solve your issue...
    Avoiding Unnecessary Update Checks (The Java™ Tutorials > Deployment > Deployment In-Depth)

  3. The Following User Says Thank You to copeg For This Useful Post:

    KevinWorkman (July 12th, 2011)

  4. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Jar Versioning with Eclipse

    That does look really promising, but it has one major drawback: now, my approach is to host one runnable Jar file, then link to that file for the applet, webstart, and runnable jar versions. So I'd rather not have to change the link to the Jar everywhere, plus I'd have to either host all old versions or risk breaking links upon update.

    I thought there was a way to specify the Jar's version in the manifest, and I was hoping that webstart (and in a perfect world, applet, but I'm not holding my breath) would check that version and re-download the Jar when necessary.

    I'm going off a few tutorials, this being one of them: Java Web Start (scroll halfway down to the "Versioning in Java Web Start" section. I might just be misunderstanding how things work.

    I'll play with your suggestion later (I'm at work now, this is for home stuff), but I was hoping for something that's internal to the Jar, or at least doesn't require changing its name.

    That is interesting though. I didn't know about that until now. Thanks.

    Edit- Actually, the tutorial I linked to might be saying the same thing as yours, only less clearly. Gah. I could have sworn there was a way, but maybe I'm out of luck. I have some pretty annoying issues where I update the Jar on the server, but then clients continue to see their old cached versions (and telling them to clear their cache would make kittens cry). I've been looking for a way around this, and thought I was on to something with the webstart thing. Shucks.
    Last edited by KevinWorkman; July 12th, 2011 at 12:47 PM.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Jar Versioning with Eclipse

    I'm not sure if you could do this through the manifest (but I could be wrong). Since the cache is client side, it will see if it has the same named jar from the same source and if so load that puppy. Since the versioning above changes the name of the jar, there shouldn't be a cached version and it will download that one. You could look into seeing if there is a no-cache protocol (although that means longer download times). Alternatively, you might want to look into creating an ANT task build script that would automate this all for you - in which case you run the build script which will create your jar and jnlp with the appropriate versioning, which you then load to the server (the upload of which could also potentially be just another step in the ant build script as well).

  6. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Jar Versioning with Eclipse

    Yeah, that's what I was afraid of. I've tried the no-cache approach, and if it worked, it would be perfect since very few of my programs take any time to load at all- actually, I tried that with a problem with HTML in Swing components not rendering properly in cached versions (remember?), but I had problems with clients simply ignoring that.

    Anyway, it's a problem I've been looking for a solution to for quite some time. I'd like to find a way that didn't involve changing the Jar name, half for my own sanity and half to not break links I post to it on forums, etc. But it's not the end of the world either way, I suppose. Thanks again for the input though, I know next to nothing about deployment and web stuff.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 24
    Last Post: August 4th, 2014, 12:49 PM
  2. Beginners Eclipse Tutorial. How to run first java application on Eclipse?
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 13
    Last Post: June 24th, 2011, 12:26 AM
  3. Replies: 4
    Last Post: February 28th, 2011, 09:49 AM
  4. eclipse help
    By mos33 in forum Java IDEs
    Replies: 3
    Last Post: November 24th, 2009, 02:10 PM