This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Spark in Action and have Jean-Georges Perrin on-line!
See this thread for details.
Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 234
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • 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
  • 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
 
Ranch Hand
Posts: 85
  • 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.
 
Grow a forest with seedballs and this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic