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="http://weblogs.java.net/">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
provides.

You have 30 seconds to explain your favorite piece of
technology. Bob Lee chooses to deliver his href="http://weblogs.java.net/pub/wlg/1861">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."


In
Also in Java Today
, in preparing for the Generics
chapter of "Thinking In Java, 4th Edition", Bruce Eckel has been
Puzzling Through
Erasure
. 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
    Object[sz];

Yakov Fain explores href="http://www.sys-con.com/story/?storyid=46344&DE=1">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
Communities
, the href="http://community.java.net/java-enterprise/">Java
Enterprise community is featuring this resource on href="https://java-enterprise.dev.java.net/getting-started.html">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="http://radio.weblogs.com/0112098/2004/09/21.html#a506">announced
ActiveSOAP "which is a pure StAX based implementation of the SOAP
1.2 protocol for implementing document centric Web Services and SOAP
intermedaries."


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

Forums
. 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
author.

On href="http://forums.java.net/jive/thread.jspa?messageID=651&tstart=0#651">
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 java.net
News Headlines
:

Registered users can submit news items for the href="http://today.java.net/today/news/">java.net 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="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net
News RSS feed.


Current and upcoming
Java Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e"> 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
Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.