Q: Is there a tool to generate the serialVersionUID for a class on the Mac? (serialver is part of the JDK on windows).
A: Yes there is. The classes for it are included
as part of the standard MRJ install. To run the SerialVer program you will need to use JBindery (part of the MRJ SDK).
To create a JBound application to run the SerialVer
program:
Launch JBindery.
In the Command panel set the class name to:
sun.tools.serialver.SerialVer
|
set the optional parameters to:
You will need to add the classes you are concerned with to the classpath. This can be done in a couple ways:
- Add your jar file or classes to the "MRJClasses" folder (located at StartupDisk:System Folder:Extensions:MRJ Libraries:MRJClasses).
- Modify the classpath in JBindery. To do this, you choose the Classpath panel in JBindery and add your classes. See the
JBindery
documentation for more information on the different ways to accomplish this.
Once you are done configuring the settings in JBindery, save the settings as an application, and use this resulting JBound application to launch the SerialVer program from the Finder.
As an example, I added a manual entry of file:///$APPLICATION/ to my classpath. This adds the folder the JBound application is in to the classpath and is useful because the target classes can be moved into the folder, and then accessed
from the SerialVer program.
By adding a manual entry of file:///$APPLICATION/ to the classpath, the Java environment will look in this folder (the application's folder) for classes it needs to load. This requires the classes be ".class" files, and not ".zip" or ".jar "files, and it requires the classes to be placed in a directory structure which represents the package the class belongs to. For instance, if I wanted the application to be able to see my class named Foo which has been defined to be in the levi.random.misc.stuff package then I would arrange my files like this:
|