This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Code for basic java classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Code for basic java classes" Watch "Code for basic java classes" New topic

Code for basic java classes

Matthew Jones
Ranch Hand

Joined: Dec 21, 2000
Posts: 68
Does anyone know where you can get the code for the basic java classes. I am espically interested in the AWT componets, but hoping to find everything.
Serge Plourde
Ranch Hand

Joined: Jun 23, 2000
Posts: 140
Hi Matthew,
If you mean the API source code, then you should be able to find it in your JDK directory. All source code is in src.jar.
Watch out! Do not decompress the files in the same directory.
Hope this helps.
Have a good day.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
You can go to the following link to the sun page for JavaTM 2 SDK, Standard Edition Documentation, click on the download page and get all the classes including the AWT.
Download to your harddrive, set you path and classpath, and you are in business.
You might want to be aware the the new swing components are (slowly) replacing the AWT because the AWT components are "heavyweight" (they have peer components on the operating system side) and the swing components available in the 1.2 release are "lightweight" components (they are completely separated from the operating system).
In addition to using less system resources, the swing components look alike on any operating system while the AWT component pick up the look and feel of the underlying operating system (i.e. a button on windows will look like a windows button. They same button on motif will look different - more like a motif button).

"JavaRanch, where the deer and the Certified play" - David O'Meara
Matthew Jones
Ranch Hand

Joined: Dec 21, 2000
Posts: 68
Thanks, I was able to find the files in src.jar and decompress to read the source.
Steven YaegerII
Ranch Hand

Joined: May 31, 2000
Posts: 182
I've extracted all the files from src.jar with the command: jar xvf src.jar and it does give me all the .java files but I cannot really make any sense of them. To me, they look more like .class files than source code. I tried to paste a small snippet of here:
public abstract long longValue(); /**

...but none of the illegible stuff would transfer to this text area (all those litte squares). Is there another process that I need to put the files through before I can understand them?
Steven YaegerII
Ranch Hand

Joined: May 31, 2000
Posts: 182
Never mind, it turns out that the files were just unreadable in NotePad but they are easy to read if you use Word. At first, I didn't think I was getting all that there was because when I'd copy & paste the source code, those little squares would disappear. I've only looked at a few files so far, and they look pretty empty without all those comments, but I think I got it now.
kishor rao
Ranch Hand

Joined: Dec 10, 2002
Posts: 35
I would suggest using a Java editor. JCreator Pro is a good one.
I agree. Here's the link:
subject: Code for basic java classes
jQuery in Action, 3rd edition