Rob Spoor wrote:C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest should be the directory to run your applications from - the folder in which the package folders are located.
Thanks, I got the sequence right finally
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>prompt $g
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:07 <DIR> .
21/05/2011 22:07 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:07 528 FileChooserTest$1.class
21/05/2011 22:07 426 FileChooserTest.class
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 22:07 677 FileIconView.class
21/05/2011 22:07 1,207 ImagePreviewer$1.class
21/05/2011 22:07 730 ImagePreviewer.class
21/05/2011 22:07 550 ImageViewerFrame$1.class
21/05/2011 22:07 1,272 ImageViewerFrame$FileOpenListener.class
21/05/2011 22:07 2,259 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:07 827 SingleRootFileSystemView.class
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
15 File(s) 16,677 bytes
2 Dir(s) 21,267,988,480 bytes free
>del *.class
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:10 <DIR> .
21/05/2011 22:10 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat //deletes all files ending with *.class
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
6 File(s) 8,201 bytes
2 Dir(s) 21,268,013,056 bytes free
>cd ..
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann
21/05/2011 19:20 <DIR> .
21/05/2011 19:20 <DIR> ..
21/05/2011 22:10 <DIR> samples
0 File(s) 0 bytes
3 Dir(s) 21,267,939,328 bytes free
>cd ..
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest
21/05/2011 19:46 <DIR> .
21/05/2011 19:46 <DIR> ..
21/05/2011 19:20 <DIR> horstmann
0 File(s) 0 bytes
3 Dir(s) 21,267,939,328 bytes free
>javac -classpath horstmann\samples horstmann\samples\*.java
>java horstmann.samples.FileChooserTest
>
>tree
Folder PATH listing
Volume serial number is 00730065 D80F:8634
C:.
└───horstmann
└───samples
However, it's weird that the following batch file does not run successfully:
17/05/2011 21:50 <DIR> ColorChooserTest
09/05/2011 22:30 <DIR> ComboBoxTest
15/05/2011 16:09 <DIR> DataExchangeTest
14/05/2011 16:55 <DIR> DialogTest
21/05/2011 22:28 <DIR> FileChooserTest
09/04/2011 19:14 <DIR> FormatTest
14/05/2011 11:55 <DIR> GridBagLayoutTest
14/05/2011 13:19 <DIR> GroupLayoutTest
10/05/2011 13:04 <DIR> MenuTest
13/05/2011 08:41 <DIR> OptionDialogTest
09/05/2011 20:47 <DIR> RadioButtonTest
09/05/2011 23:42 <DIR> SliderTest
08/05/2011 22:41 <DIR> TextComponentTest
10/05/2011 13:27 <DIR> ToolBarTest
0 File(s) 0 bytes
20 Dir(s) 21,266,780,160 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09>cd FileChooserT
est
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest
21/05/2011 22:28 <DIR> .
21/05/2011 22:28 <DIR> ..
21/05/2011 22:26 0 2.log
21/05/2011 22:17 1,685 Command Prompt.lnk
21/05/2011 22:27 184 compile.bat
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:28 0 error.log
21/05/2011 22:16 5,134 FileChooserTest.java
21/05/2011 19:20 <DIR> horstmann
13/04/2008 15:06 152 palette.gif
21/05/2011 22:16 1,036 SingleRootFileSystemView.java
8 File(s) 8,220 bytes
3 Dir(s) 21,266,780,160 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>java horstmann.samples FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann/samples
Caused by: java.lang.ClassNotFoundException: horstmann.samples
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: horstmann.samples. Program will exit.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>cd horstmann\samples
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>java horstmann.samples FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann/samples
Caused by: java.lang.ClassNotFoundException: horstmann.samples
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: horstmann.samples. Program will exit.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:28 <DIR> .
21/05/2011 22:28 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:28 582 FileChooserTest$1.class
21/05/2011 22:28 462 FileChooserTest.class
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 22:28 695 FileIconView.class
21/05/2011 22:28 1,279 ImagePreviewer$1.class
21/05/2011 22:28 784 ImagePreviewer.class
21/05/2011 22:28 622 ImageViewerFrame$1.class
21/05/2011 22:28 1,434 ImageViewerFrame$FileOpenListener.class
21/05/2011 22:28 2,439 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:28 845 SingleRootFileSystemView.class
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
15 File(s) 17,343 bytes
2 Dir(s) 21,266,780,160 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>java FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: FileChooserTest (wron
g name: horstmann/samples/FileChooserTest)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: FileChooserTest. Program will exit.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:28 <DIR> .
21/05/2011 22:28 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:28 582 FileChooserTest$1.class
21/05/2011 22:28 462 FileChooserTest.class
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 22:28 695 FileIconView.class
21/05/2011 22:28 1,279 ImagePreviewer$1.class
21/05/2011 22:28 784 ImagePreviewer.class
21/05/2011 22:28 622 ImageViewerFrame$1.class
21/05/2011 22:28 1,434 ImageViewerFrame$FileOpenListener.class
21/05/2011 22:28 2,439 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:28 845 SingleRootFileSystemView.class
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
15 File(s) 17,343 bytes
2 Dir(s) 21,266,780,160 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>java FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: FileChooserTest (wron
g name: horstmann/samples/FileChooserTest)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: FileChooserTest. Program will exit.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>type JFileChooser.java
The system cannot find the file specified.
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:28 <DIR> .
21/05/2011 22:28 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:28 582 FileChooserTest$1.class
21/05/2011 22:28 462 FileChooserTest.class
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 22:28 695 FileIconView.class
21/05/2011 22:28 1,279 ImagePreviewer$1.class
21/05/2011 22:28 784 ImagePreviewer.class
21/05/2011 22:28 622 ImageViewerFrame$1.class
21/05/2011 22:28 1,434 ImageViewerFrame$FileOpenListener.class
21/05/2011 22:28 2,439 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:28 845 SingleRootFileSystemView.class
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
15 File(s) 17,343 bytes
2 Dir(s) 21,266,780,160 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>del *.class
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples
21/05/2011 22:30 <DIR> .
21/05/2011 22:30 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:09 5,164 FileChooserTest.java
21/05/2011 19:10 57 JFileChooser.manifest
13/04/2008 15:06 152 palette.gif
21/05/2011 22:10 1,066 SingleRootFileSystemView.java
6 File(s) 8,201 bytes
2 Dir(s) 21,266,808,832 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>type del_class.bat
@echo off
del *.class
pause
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>cd ..
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann
21/05/2011 19:20 <DIR> .
21/05/2011 19:20 <DIR> ..
21/05/2011 22:30 <DIR> samples
0 File(s) 0 bytes
3 Dir(s) 21,266,735,104 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann>cd ..
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634
Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest
21/05/2011 22:28 <DIR> .
21/05/2011 22:28 <DIR> ..
21/05/2011 22:26 0 2.log
21/05/2011 22:17 1,685 Command Prompt.lnk
21/05/2011 22:27 184 compile.bat
21/05/2011 19:24 29 del_class.bat
21/05/2011 22:28 0 error.log
21/05/2011 22:16 5,134 FileChooserTest.java
21/05/2011 19:20 <DIR> horstmann
13/04/2008 15:06 152 palette.gif
21/05/2011 22:16 1,036 SingleRootFileSystemView.java
8 File(s) 8,220 bytes
3 Dir(s) 21,266,735,104 bytes free
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>compile.bat
Could Not Find C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\
FileChooserTest\horstmann\samples\*.class
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann/samples
Caused by: java.lang.ClassNotFoundException: horstmann.samples
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: horstmann.samples. Program will exit.
Press any key to continue . . .
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>type compile.bat
@echo off
cd horstmann\samples
del *.class
cd ..\..
javac -classpath horstmann\samples horstmann\samples\*.java
java horstmann.samples FileChooserTest > error.log
pause
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>tree
Folder PATH listing
Volume serial number is 00730065 D80F:8634
C:.
└───horstmann
└───samples
C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>