Home arrow static arrow Java Programming [Archive] - set copyright and version information on .class and .jar files
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - set copyright and version information on .class and .jar files
10 Duke Stars available
This topic has 3 replies on 1 page.

Posts:2
Registered: 8/4/04
set copyright and version information on .class and .jar files  
Aug 4, 2004 1:57 AM



 

Hi all,
i'm developing java applications on windows platforms. Is it possible to add a stamp on .class and .jar files (i.e. with copyright and product version informations) i want to distribute, in a way they're visible in the windows explorer?

i know that is possible on .exe files .

thanks in advance
F
 

Posts:319
Registered: 11/8/00
Re: set copyright and version information on .class and .jar files  
Aug 4, 2004 2:06 AM (reply 1 of 3)



 
You can add data to the Jar files manifest, see: http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html#versioning, but ti know this is not what you want.

A quick look in explorer shows this information is not available but you can specify a summary, this might be a way around your problem.
 

Posts:3,055
Registered: 18/06/98
Re: set copyright and version information on .class and .jar files  
Aug 4, 2004 7:04 AM (reply 2 of 3)



 
The VERSION resource is only available for executable files (.EXE, .DLL etc.)
The Windows Explorer unfortunately don't know how to read MANIFEST.MF files (although someone could write an Explorer extension that could do exactly that).

If you have a installer that
a) can recognize NTFS filesystems (used in NT4, 2000, XP and 2003)
and
b) can write the summary (technically it's a "stream" of the file)
you can show the data you want to show.

I don't know the format of "Document Summary Information" streams.

If you're curious about "streams" try this page ( http://www.sysinternals.com/ntw2k/source/misc.shtml ). A little excerpt:

Streams
The NTFS file system provides applications the ability to create alternate data streams of information. By default, all data is stored in a file's main unnamed data stream, but by using the syntax "file:stream", you are able to read and write to alternates. Not all applications are written to access alternate streams, but you can demonstrate streams very simply. First, change to a directory on a NTFS drive from within a command prompt. Next, type "echo hello > test:stream". You've just created a stream named 'stream' that is associated with the file 'test'. Note that when you look at the size of test it is reported as 0, and the file looks empty when opened in any text editor. To see your stream enter "more < test:stream" (the type command doesn't accept stream syntax so you have to use more).

NT does not come with any tools that let you see which NTFS files have streams associated with them, so I've written one myself. Streams will examine the files and directories (note that directories can also have alternate data streams) you specify and inform you of the name and sizes of any named streams it encounters within those files. Streams makes use of an undocumented native function for retrieving file stream information. Full source code is included.
 

Posts:14,142
Registered: 99-04-02
Re: set copyright and version information on .class and .jar files  
Aug 4, 2004 7:13 AM (reply 3 of 3)



 
About the only versioning thing Java has built-in is using serialver to generate the serialVersionUID for classes. But that's usually a private field. About the only other thing I could think of would be maybe Java could have a Version interfaces that could be used in classes:
package java.lang;public interface Versionable { // or maybe Copyrightable?   public String getVersion();   public String getCopyright();}
 
This topic has 3 replies on 1 page.