Monday, February 23, 2009

Make Tiny Time Tracker launch faster!

I like the Tiny Time Tracker application available from Source Forge that allows you to easily track how much time you spend on different tasks or projects. I highly recommend it. Its interface is very simple, but powerful. It basically has a drop down list that floats above all other windows. You can position it anywhere. You can shift time from one project to another if you forget to change it when you actually switched projects. It even stores the data to Excel. So, you get a very good reporting tool without any exporting. So, what is the problem you ask. Well, quite simply it takes way too long to open up. It takes like 30 seconds to open sometimes. If it is when I boot, it is even worse, but that is probably because of all the start up apps I have. In my mind, this is a very simple application that should open in like 1-3 seconds, not 15 to 30 seconds. I think the problem is Java WebStart. It looks for updates before it loads the local copy. Plus, just opening WebStart takes many seconds. I decided to see how fast the application launches if I run the jar directly. I was very happy with the results. It launched in 1 to 2 seconds!!! The problem with the default installation of Tiny Time Tracker is that what you actually download is a .jnlp file. All this file does is tell the WebStart application where to download the latest copy from. What we need is the .jar file, not the .jnlp file. If you want your Tiny Time Tracker application to launch extremely fast, I recommend doing the following:
  1. Go to the CVS repository and select tinytimetracker.jar and download the latest tinytimetracker.jar. You will probably need to download poi-3.5-beta3-20080926.jar if you don't have it.
  2. You can put the tinytimetracker.jar file anywhere on your system. For simplicity, I assume you are putting it at c:\TinyTimeTracker\tinytimetracker.jar.
  3. Using Windows Explorer, navigate to the C:\TinyTimeTracker directory.
  4. Right-click and choose New | Shortcut.
  5. For the location of the item field that comes up, just enter the following: javaw -cp "C:\TinyTimeTracker\tinytimetracker.jar" tracker.Tracker
  6. Name the shortcut whatever you want to.
  7. Now you can double-click the shortcut and Tiny Time Tracker will launch much faster than it ever did using Java WebStart.
If you have any problems, you can also run the same command from the command line. This will give you more information.

5 comments:

Anonymous said...

Hi, I'm not a programmer but I did not have any luck getting this to work on my system. I can get the webstart version to work just fine. I am researching this and have some good Java people where I work. Just a comment back for you from a novice.
My batch file has;
javaw -cp "d:\Timecards\TinyTimeTracker.jar" tracker.Tracker

Here is the error I get.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/formula/FormulaParsingWorkbook
at tracker.TimeTracker.initializeCalendar(TimeTracker.java:500)
at tracker.TimeTracker.(TimeTracker.java:69)
at tracker.Tracker.start(Tracker.java:50)
at tracker.Tracker.main(Tracker.java:24)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.formula.FormulaParsingWorkbook
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 4 more

Anonymous said...

Follow-up;
It works if I place "poi-3.5-beta3-20080926.jar" in the tinytimetracker dir. I found this in the webstart file "resources>
j2se version="1.5+" />
jar href="tinytimetracker.jar"/>
jar href="poi-3.5-beta3-20080926.jar" />
/resources>
application-desc main-class="tracker.Tracker"/>
/jnlp>

So it made sense to me that it must be needed also. So maybe the Java Gurus at work will be able to help. Since poi is a huge file.

Brent V said...

Hi Anonymous,

I don't have that problem with mine. I guess the class is in my classpath by other means. I noticed it was in a sub-directory of the directory where the TinyTimeTracker.jar is located. Though, when I remove that sub-directory it makes no difference. A mystery to me.

However, I would say that your problem is that poi-3.5-beta3-20080926.jar file needs to be in your classpath.

I would recommend adding it to your command line. Assuming that it is in the same directory as your TinyTimeTracker.jar, try the following command line.

javaw -cp "d:\Timecards\poi-3.5-beta3-20080926.jar;d:\Timecards\TinyTimeTracker.jar" tracker.Tracker

Unknown said...

I just want to say Hi, and recommend this app : www.timecamp.com . Cin cin!

jivkost1 said...

Thank you so much for this useful information fellas and I have to tell you that I search more information about java WebStart from a long time ago.