File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
André Asantos
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
André Asantos
Ranch Hand
Posts: 234
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic