Results 1 to 4 of 4
  1. #1
    lmsf is offline Member
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Default Set file number on .class file

    Hi to all,

    like you know, to check the version of a dll its very easy.
    But how to put a specific version in a .class file? There is a way?

    example for dir xpto/classes:

    xxx.class (version 1.2 - hotfix)
    xxy.class (version 1.1)
    xxc.class (version 1.1)
    ....

    i need help :)

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    I don't think it's possible to do with a class file in more specific way other than specifying in a comment.

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    You can't fuss with the name of the .class file. However, you can do the following:
    • Use source version control software, such as Subversion.
    • Add a serial number to the JAR file containing the class.
    • Add a public static final field to the class.

    Source version control is the best approach overall, and it makes doing other approaches easier.
    Serialization uses the last approach. It looks for a field
    Java Code:
    private static final long serialVersionUID = 1234;

  4. #4
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Yep to what Steve said. The serialVersionUID is the mechanism used by swing. There really just is no getting around a developer knowing whether or not a class file remains compatible with previous versions.

    If you have a class file and can't figure out what version it's from, you could execute a checsum on it and compare that to the checksums of various releases....cumbersome, but perhaps your only recourse if you didn't plan ahead for this.

Similar Threads

  1. converting java class file to exe file
    By satheeshtech in forum Advanced Java
    Replies: 5
    Last Post: 07-19-2009, 12:47 AM
  2. How to create .exe file using .class file
    By pradnya in forum New To Java
    Replies: 8
    Last Post: 04-18-2009, 01:50 AM
  3. .class file to .java file
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 02-20-2009, 07:46 PM
  4. How to get value number from text file?????
    By hongan in forum New To Java
    Replies: 10
    Last Post: 10-01-2008, 04:37 AM
  5. Convert my class file into a exe file
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 09:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •