permaculture playing cards
The moose likes Beginning Java and the fly likes Is there a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there a "view source" for Java?" Watch "Is there a "view source" for Java?" New topic

Is there a "view source" for Java?

Jake Miller
Ranch Hand

Joined: Jun 27, 2007
Posts: 43
Is there a way to view the source code for any java app/program I find online like you can with HTML (usually)? I am trying to get a better grasp of how java programs are actually written, or is it not really possible because of the JVM?
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
There is no "view source" for Java programs, but you do have options. A *lot* of libraries that you can download and use from different sources have viewable source code. One of the best resources is the jdk that you probably have installed on your computer now. If you go to the folder where you have the jdk installed, you will find a folder called src. Unzip this folder with whatever tool you like best, and you can view the source code of all the Java library classes. It helps if you start with a class that you are most intimately experienced with using. If you know what a class/method does in a black box sense, then you will understand better what you are looking at when you *open the hood* and see *how* the class does what it does.

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
KasiMurugan Ramasamy
Ranch Hand

Joined: Jan 30, 2005
Posts: 125

If your requirement is to see the source code for a any class, you can try to use JAD(Decompiler).

You can install it in your machine and use it. And also you can use it as elcipse plugin.

Thanks & Regards
Kasimurugan (SCJP1.4, SCBCD1.3), Preparing SCWCD1.4
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
you can try to use JAD(Decompiler).[/QB]

... keeping in mind that this is most likely illegal for any software that is licensed under a non-open/non-free license (and for open-source software you don't need it to begin with).
I agree. Here's the link:
subject: Is there a "view source" for Java?
jQuery in Action, 3rd edition