aspose file tools*
The moose likes Beginning Java and the fly likes Java Extensions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Extensions" Watch "Java Extensions" New topic
Author

Java Extensions

Rama Krishna Yalamanchili
Greenhorn

Joined: Feb 11, 2004
Posts: 25
Hi Ranchers,
Can anyone please tell me "What are extensions?".
I know these are packages with lot of useful classes..
Does all extensions start with Javax.*****.* ?
If not how do i know which are under standard and which are under extension libraries?


You are not fed, if you dont ask. <img src="wink.gif" border="0"> <p>SCJP 1.4, i2CP, IBM s390 CP
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Java extensions are not anything special really. They are just other classes in the JDK. When Java was first developed (back in the version 1.0 days) all the standard classes were put in java.abcd packages. They also included "non-standard" classes and packages at "extensions" in the extension packages of javax.abcd. These extension classes were classes that Sun considered non-core (for the lack of a better description). The original plan was that at some point in the process of the JDK development and improvement that as extension classes matured, they could/would get moved into the standard (or core) classes by being change to java.abcd packages. So javax.somePackage would become java.somePackage. However, it was realized that doing such would break existing programs and code and thus prevent them from being forward compatible. So if my program written for Java 1.0.2 used/imported javax.somePackage.SomeClass, if the package was moved and became java.somePackage.SomeClass in JDK 1.2, my program would not be compatible using 1.2 or later. Therefore, in the end, Sun did not employ this strategy and javax.abcd packages stayed javax.abcd packages.
Today extensions packages are simply other packages in the JDK. You really do not need to worry about them in any other way or try & determine what the differences are. Essentially, it is just a historical naming convention that has no significant meaning today. The only real significance is you need to remember if a package is part of java.* or javax.*
[ February 14, 2004: Message edited by: Mark Vender ]
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

By the way, be sure not to confuse the extension classes with "The Extension Mechanism" of the Java Platform. You can read about that at The Extension Mechanism lesson at Sun's online Java Tutorial.
Rama Krishna Yalamanchili
Greenhorn

Joined: Feb 11, 2004
Posts: 25
Thank you Mark for the Tutorial on Extensions.
Just to be more sure of this usage.
Can i put the j2ee.jar file in the extension library
$Home/user/jdk1.4/jre/lib/ext.
Can i compile my servlets if i put it in this library.
:roll:
As far as i can visualize from the documentation these extensions classes are seen by the JVM at run time.
Is it also allowed to put in my extension classes that i need to compile a j2ee web document in this library?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Can i compile my servlets if i put it in this library.
You could. I prefer to include it in my classpath when it's needed.
Is it also allowed to put in my extension classes that i need to compile a j2ee web document in this library?
You could, but the normal and recommended practice is to not place third party libraries in the ext directory - it should be saved for official Java extension APIs.
Again, I prefer to reference needed libraries (that are not part of J2SE) in my classpath at compile time.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
 
subject: Java Extensions