Firefox Incorrect Window Position

April 25, 2008

Okay. I’ve been enjoying Firefox 3 Beta, but today it started opening up its window way off to the right of my desktop and about the height and width of a stamp. WTF? A little Googling led me to a fix: Corrupt localstore.rdf. So if you’re Firefox window starts misbehaving, try deleting localstore.rdf in your Firefox profile folder and letting Firefox re-create it.

So, why am I blogging about something mundane like this? A few reasons:

  1. I’m trying out the latest update to ScribeFire
  2. Trying to get more in the habit of blogging.
  3. Sometimes it’s nice to have stuff like this tip blogged for the next time around

Tags

Determine a the JDK version used to make a JAR file

Maybe there’s already a tool to do this, but a quick Google search only yield this tip.  So, I made a quick little JAR reader to fetch the estimated version from the manifest:

import java.util.*;
import java.util.jar.*;
import java.io.*;

/*
 * Sends the "estimated" JDK version (expected to be in the jar manifest "Created-By" attribute)
 * to System.out.
 */
public class JarJDKVersion {

	public static void main(String[] args) {

		JarFile jarFile = null;
		Manifest manifest = null;
		String version = null;
		
		// Report usage if no parameters given
		if (args.length < 1) {
			System.out.println("usage: java JarJDKVersion ");
			System.exit(0);
		}
		
		// Open specified jar file
		try {
			jarFile = new JarFile(args[0]);
		} catch (IOException e) {
			System.err.println("Unable to read jar file: " + args[0]);
			System.exit(1);
		}
		
		// Fetch manifest from jar file
		try {
			manifest = jarFile.getManifest();
		} catch (IOException e) {
			System.err.println("Unable to read manifest from jar file: " + args[0]);
			System.exit(2);
		}
		
		// Display version from jar manifest
		Attributes attributes = manifest.getMainAttributes();
		version = attributes.getValue("Created-By").toString();
		if (version != null)
			System.out.println(version);
		else {
			System.err.println("Unable to determine version from jar manifest.");
			System.exit(3);
		}
		
	}

}

Download the source code or the class file.