aspose file tools*
The moose likes Beginning Java and the fly likes Where is Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Where is Java?" Watch "Where is Java?" New topic
Author

Where is Java?

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Where on my computer (win) can I find the java packages?

After I installed java, I got a new directory called "c:\java"

But, I am sorry, when I looked inside I could not see the java pacgage hierarchy: java.net, java.io, java.applet etc.

When I made a search for "java" over my c:\ hard drive, I got a directory which is called "java" that had all the java hierarchy inside it, but could not understand from windows where it is physically located on my c:\ hard drive.

1) what actually are those things that I saw in the c:\java

2) what actually is that mysterious java directory that I have found in my search and where is it physically located on my c:\ hard drive.

Thank...


We must know, we will know. -- David Hilbert
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
If you're looking for the source .java files, they aer installed optionally in a ZIP archive inside the Java directory. When I installed JDK 1.5, I told it to put it all in c:\Java\jdk1.5.0_01. The sources were in the archive c:\Java\jdk1.5.0_01\src.zip. You can unzip them and browse at your leisure.
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Yes I can see that src.zip in my c:\java

How can java use them if they are trapped inside that zip file?
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
I expect that the actual .class files for the Java classes with names starting with java. and javax. are packed into Java ARchive (JAR) files, whose names I don't know offhand. This saves disk space and makes searches for the classes your programs need faster and less platform-dependent.

If you want to explore the Java library classes, just download the source code here:
http://java.sun.com/j2se/1.5.0/download.jsp

Not only do they help you understand these classes better, but the code itself was written by some of the best Java programmers around and I found the coding style, organization, and use of encapsulation worth studying.

One word of warning: writing programs that depend on the internal structure of library classes, not just their public interface, is considered bad practice and is risky because Sun is free to change implementation in new releases even if this breaks your code.

Seeing the way the Java language is used by James Gosling and his colleagues refutes some of the coding no-no's I have seen in school and on this site. It reminds me of the Woody Allen movie "Annie Hall". Standing in line for a movie, Allen gets incensed when a loudmouth misinterprets the work of Marshal McLuhan so Allen pulls McLuhan himself from off-camera and McLuhan corrects the man.


Mike Gershman
SCJP 1.4, SCWCD in process
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Most of the actual runtime API classes are in java\jre\lib\rt.jar . Some more esoteric ones are in other jars in that directory or elsewjere.


[Jess in Action][AskingGoodQuestions]
Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
Thank you all for your replies.

In the readme.html file in the c:\java it says JavaTM 2 Platform Standard Edition - Development Kit 5.0

Also, a few days ago I was trying to install j2sdkee1.3.1
It is not the lastest version however I was trying to run hsqldb 1.6.1 database on my computer and they said it will work with 1.4.1

So I got another directory called c:\j2sdkee1.3.1

Why can I not find any src.zip and jre directory in that c:\j2sdkee1.3.1 directory, and if they are not there then what is that directory supposed to do?

Thank you for your help.
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by Joseph Sweet:
Yes I can see that src.zip in my c:\java

How can java use them if they are trapped inside that zip file?
Those are the Java source files -- the human-readable text files. They were compiled (using javac) into bytecode .class files that the JVM uses to run code. Those are stored as Ernest said inside a JAR file. The reason the sources are left as a ZIP is to save disk space in case you didn't really want to look at the files. Just unZIP them into the same directory so you can explore them as they're a great compliment to the JavaDocs.
Why can I not find any src.zip and jre directory in that c:\j2sdkee1.3.1 directory, and if they are not there then what is that directory supposed to do?
The J2EE SDKs (j2sdkee) are only extensions of the JDK -- they add more classes for the J2EE APIs, but the SDK itself does not contain a javac compiler or JRE (JVM for running code). You use the JDK and JRE you already have to use them.

I don't remember off-hand if the sources are included by default with the J2EE SDKs. If not, then go back to the download site and grab them; they should be a separate package. They are definitely available.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where is Java?