• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic