Skip to main content

New Main-Class

Posted by daniel on September 21, 2004 at 9:59 AM PDT

A cool jar-file hack

In today's href="">Weblogs, Laird Nelson
offers up a Cheap
Hack I: rename your jar file, get a different Main-Class
. The
hack is very cool - I love these kind of blog entries. He "put
together a class that itself is installed as the Main-Class in a
jar file, but which consults a file (also in the jar) to let it
know what class to actually use as the main class. The hackish
part is that all you have to do is rename the jar file for the
"right" Main-Class to be selected." Check out the code he

You have 30 seconds to explain your favorite piece of
technology. Bob Lee chooses to deliver his href="">AOP Elevator
Speech. At its core, "AOP enables me to leave my form classes
untouched and to fully decouple reusable functionalities. My form
classes shouldn't care that I'm caching the validation result. With
AOP, I can implement the caching logic in one module and apply it at
runtime or build time to all of my forms or to other places that
follow a similar pattern. Each new form I add will enjoy caching for
free. I've gone from a constant maintenance effort to zero effort
thanks to AOP. Plus, I have a lot less code to unit test."

Also in Java Today
, in preparing for the Generics
chapter of "Thinking In Java, 4th Edition", Bruce Eckel has been
Puzzling Through
. He complains that if he has "a type parameter T, not
only am I prevented from making an instance of that type (because,
with erasure, the type is forgotten), I cannot make an array of
that type. However, I can generate an array of Object and cast it
to T[]." In other words, he wants to write something like
private T[] array= new T[sz]; But is forced instead
to use something like

private T[] array= (T[])new

Yakov Fain explores href="">Java Gotchas:
Instance Variables Hiding. Java newbies (and those stumped by
unexpected behavior) should check out his piece that looks at
overriding, hiding, and shading. "If methods with the same signatures
or member variables with the same name exist in ancestor and
descendant classes, the Java keyword super allows access members of
the ancestor. But what if you do not use the keyword super in the
descendant class? In case of methods, this is called method overriding
and only the code of the descendant's method will execute. But when
both classes have a member variable with the same name, it may cause a
confusion and create hard to find bugs."

In Projects and
, the href="">Java
Enterprise community is featuring this resource on href="">Getting
Started with the J2EE Platform. The page includes links to
download J2EE, to tutorials, and to resources such as the
Blueprints pages.

James Strachan has href="">announced
ActiveSOAP "which is a pure StAX based implementation of the SOAP
1.2 protocol for implementing document centric Web Services and SOAP

If you want to get ahead on the next two bookclub selections, they are posted in today's

. In honor of the upcoming Tiger release, our
next selection is Brett McLaughlin's "Java 1.5 Tiger: A
Developer's Notebook" followed by Joshua Kerievsky's
"Refactoring to Patterns". Each discussion will be led by the

On href="">
JSR discussions, Robilad writes "Some JSRs have very active, open
communities outside the official JSR infrastructure, where the actual
details of specifications seem to get hammered out. Given that
participants to some of the fundamental modifications to the platform
seem to prefer to meet outside the JCP infrastructure to discuss their
ideas in the open, I'm wondering how well that reflects on JCP's
current provisions to foster collaboration. Would a more liberal JCP
be a better thing?"

In today's
News Headlines

Registered users can submit news items for the href=""> News Page
using our news
submission form
. All submissions go through an editorial
review before being posted to the site. You can also subscribe to
the href="">
News RSS feed.

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered
weekdays as the
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.