Problem with classpath
Guys,
I am in need of explanation on the command line statement to run the following programme (from a book). The location (package structure) of the programme is shown in the screen shot of a DOS window below. I have used asterics to delineate the sections for easy copying.
Please, show me how you are able to run the programme from the command line.
Thanks,
ue-Joe
*******************************************************************************************
// joejava/util/tools/Print.java
// Print methods that can be used without qualifiers, using Java SE5 static imports:
package joejava.util.tools;
import java.io.*;
public class Print
{
// Print with a newline.
public static void print(Object obj)
{
System.out.println(obj);
}
// Print a newline itself.
public static void print()
{
System.out.println();
}
// Print with no line break.
public static void printnb(Object obj)
{
System.out.print(obj);
}
// The Java SE5 printf()(from C)
public static PrintStream printf(String format, Object... args)
{
return System.out.printf(format, args);
}
}
**************************************************************************************
import static joejava.util.tools.Print.*;
public class PrintTest
{
public static void main(String[] args)
{
print("Available from now on!");
print();
print(100);
print();
print(100L);
print();
print(3.14159);
print();
printf("%d \n", 3.14159);
}
}
*************************************************************************************
C:\joejava\util\tools>dir
Volume in drive C has no label.
Volume Serial Number is F4E5-2352
Directory of C:\joejava\util\tools
06/26/2007 02:22 AM<DIR> .
06/26/2007 02:22 AM<DIR> ..
06/25/2007 02:58 AM650 Print.class
06/26/2007 02:23 AM111 Print.jar
06/25/2007 02:52 AM826Print.java
06/25/2007 08:17 PM757 PrintTest.class
06/25/2007 02:56 AM285PrintTest.java
5 File(s) 2,629 bytes
2 Dir(s) 25,246,867,456 bytes free
C:\joejava\util\tools>java PrintTest
Exception in thread "main" java.lang.NoClassDefFoundError: joejava/util/tools/Print
at PrintTest.main(PrintTest.java:7)
C:\joejava\util\tools>java -jar PrintTest.jar
Unable to access jarfile PrintTest.jar
C:\joejava\util\tools>
**************************************************************************************

