Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar tool wrong last modified time for html files

 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I got a strange problem with the jar tool (JDK 5.0) both on Windows and on Linux.
Do the following:
on the command prompt, go to the directory containing your instructions.html file (URLyBird).
Take note of the last modified time (using dir or ls command)
Now jar the html file into a simple test jar like so:

jar -cf myjar.jar instructions.html

When you now look inside myjar.jar (using winzip on Windows, or File Roller on Linux) you will notice that the modified time differs by one hour, well at least in my case.

example:

You will notice that the modified time of the html file is approx 14:00h, however the html file inside the jar shows a last modified time of 15:00h ???

How can this be ?

The funny thing is that if I look inside the jar using the jar command itself, the last modified time looks ok:



So it looks like this is a problem both for Winzip and File Roller...
Anyone else notice this ?

Regards,
Ronald Wouters
[ February 07, 2006: Message edited by: Ronald Wouters ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ronald,

I think you will find that the jar tool is storing dates and times in GMT, and converting them back to local time again later. 1 hour out should be right for Belgium. And mine look roughly right for Australia:Regards, Andrew
 
Ronald Wouters
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew for clearing that up.
I suspected as much, that it must have had something to do with timezones I mean. Glad you could confirm it. Didn't find anything in the JDK tool docs though about the jar tool storing times in GMT.
I guess Winzip and File Roller are too smart for there own good

Regards,
Ronald Wouters
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic