Developper said:
I am new to Java. I hope someone can give me a hint.
Two notes in this regard:
1. comp.lang.java.help is more appropriate for questions like these.
2. If you haven't already, try and find some tutorials and/or books to
explain the basics to you. There have been some threads to this very
topic recently.
What is the difference between package and jar files and do you use them ?
A package is the equivalent of a .NET or C++ namespace, organized into a
directory structure.
For example, I frequently try stuff in a simple class called JavaTest.
This class is placed in the package nl.opk, so the directories the source
and code of this class in my project are:
<project directory>/source/nl/opk/JavaTest.java
<project directory>/source/nl/opk/JavaTest.class
To use a package, put a line like this as first non-empty non-comment line
in your file:
package my.package;
Also make sure the file is in the correct directory (see above).
A .jar file is an archive. In fact, it's a .zip file with a META-INF
directory with a MANIFEST.MF file in it. It can contain anything, which
includes classes (inside the directories that describe their packages). It
can also include source code, javadoc documentation and/or other resources
(files).
..jar files are created using the jar tool supplied with the JDK/SDK.
..jar files are used by placing them in the classpath, or by starting java
with the -jar switch. Read the manuals of "jar" and "java" for more info.