aspose file tools*
The moose likes Beginning Java and the fly likes Difference between .class, .jar, .java and others Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between .class, .jar, .java and others" Watch "Difference between .class, .jar, .java and others" New topic
Author

Difference between .class, .jar, .java and others

André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
hello guys,

can you help me please saying me the difference between .class, .jar, .java and others?

thanks in advance!



take care!
André AS
São Paulo - Brazil
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

A java file contains Java code. A Java file is compiled to produce a class file that can be loaded by the JVM. The contents of a class file are rather well explained here. A Jar file is an archive of otherfile, most likely class files.

As for "others", which others did you have in mind?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
André Asantos
Ranch Hand

Joined: Nov 23, 2009
Posts: 234
I loved your reply...

In other words .class means the code that is interpreted by the JVM, the .java is a extension from the class and the .jar is the Java archive, right?


see you, take care!
André AS
Rajeev Trikha
Ranch Hand

Joined: Jan 29, 2010
Posts: 85
.java is your source file which you pass to the compiler (javac) to produce .class file. jar can contain your classes. If you are compiling a class which needs other classes you can have a syntax like

javac -classpath myApp.jar Test.java

The JVM interpreter always work with the bytecode in the .class file.

To feel comfortable with jar, see some online tutorials but basically the key flags are

jar -tf myJar.jar for display -xf for extract and -cf for create.


Rajeev Trikha (SCJP 6)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between .class, .jar, .java and others