wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes [error] error: Class names, 'JFileChooser', are only accepted if annotation processing is explicit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "[error] error: Class names, Watch "[error] error: Class names, New topic
Author

[error] error: Class names, 'JFileChooser', are only accepted if annotation processing is explicit

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

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>cd ..

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 18:48 <DIR> .
21/05/2011 18:48 <DIR> ..
21/05/2011 18:47 <DIR> horstmann
0 File(s) 0 bytes
3 Dir(s) 21,312,352,256 bytes free

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
>javac -classpath \horstmann\samples horstmann\samples\*.java

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>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 18:55 <DIR> .
21/05/2011 18:55 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 18:58 582 FileChooserTest$1.class
21/05/2011 18:58 462 FileChooserTest.class

21/05/2011 18:46 5,164 FileChooserTest.java
21/05/2011 18:58 695 FileIconView.class
21/05/2011 18:58 1,279 ImagePreviewer$1.class
21/05/2011 18:58 784 ImagePreviewer.class
21/05/2011 18:58 622 ImageViewerFrame$1.class
21/05/2011 18:58 1,434 ImageViewerFrame$FileOpenListener.class
21/05/2011 18:58 2,439 ImageViewerFrame.class

21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
21/05/2011 18:58 845 SingleRootFileSystemView.class
21/05/2011 18:47 1,066 SingleRootFileSystemView.java
14 File(s) 17,314 bytes
2 Dir(s) 21,313,470,464 bytes free

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>javac JFileChooser
error: Class names, 'JFileChooser', are only accepted if annotation processing i
s explicitly requested

1 error

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>javac JFileChooserTest
error: Class names, 'JFileChooserTest', are only accepted if annotation processi
ng is explicitly requested
1 error

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>

ileChooserTest\horstmann\samples

21/05/2011 18:46 5,164 FileChooserTest.java
21/05/2011 18:47 1,066 SingleRootFileSystemView.java
2 File(s) 6,230 bytes
0 Dir(s) 21,317,210,112 bytes free

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>edit FileChooserTest.java
The system cannot execute the specified program.

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 19:03 <DIR> .
21/05/2011 19:03 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 18:46 5,164 FileChooserTest.java
21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
21/05/2011 18:47 1,066 SingleRootFileSystemView.java
5 File(s) 8,172 bytes
2 Dir(s) 21,317,251,072 bytes free

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>type FileChooserTest.java

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 19:05 <DIR> .
21/05/2011 19:05 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 18:46 5,164 FileChooserTest.java
21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
21/05/2011 18:47 1,066 SingleRootFileSystemView.java
5 File(s) 8,172 bytes
2 Dir(s) 21,316,603,904 bytes free

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>type SingleRootFileSystemView.java

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>

Code sourced from Core Java Volume I (8th Edition)

Jon
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13875
    
  10

You should run that like this:

cd C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
java horstmann.samples.FileChooserTest


You must be in the base directory of the package and specify the fully-qualified class name with the java command.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

Jesper de Jong wrote:You should run that like this:

cd C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
java horstmann.samples.FileChooserTest


You must be in the base directory of the package and specify the fully-qualified class name with the java command.


I still get this error, and, I also tried setting the environment variable CLASSPATH to ".", for testing only, because Corstmann recommends that the CLASSPATH variable should be set and unset carefully by installation scripts, since they might obviously affect the location of the Java library files required to run the JVM.

Directory of C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\F
ileChooserTest\horstmann\samples

21/05/2011 19:21 <DIR> .
21/05/2011 19:21 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:30 528 FileChooserTest$1.class
21/05/2011 19:30 426 FileChooserTest.class
21/05/2011 19:22 5,134 FileChooserTest.java
21/05/2011 19:30 677 FileIconView.class
21/05/2011 19:30 1,207 ImagePreviewer$1.class
21/05/2011 19:30 730 ImagePreviewer.class
21/05/2011 19:30 550 ImageViewerFrame$1.class
21/05/2011 19:30 1,272 ImageViewerFrame$FileOpenListener.class
21/05/2011 19:30 2,259 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
21/05/2011 19:30 827 SingleRootFileSystemView.class
21/05/2011 19:22 1,036 SingleRootFileSystemView.java
15 File(s) 16,645 bytes
2 Dir(s) 21,313,896,448 bytes free

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/Fil
eChooserTest
Caused by: java.lang.ClassNotFoundException: horstmann.samples.FileChooserTest
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.FileChooserTest. Program will
exit.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Jon>cd workspace

C:\Documents and Settings\Jon\workspace>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634

Directory of C:\Documents and Settings\Jon\workspace

19/05/2011 00:03 <DIR> .
19/05/2011 00:03 <DIR> ..
28/11/2010 13:35 <DIR> .metadata
17/05/2011 10:12 <DIR> JavaDev
19/05/2011 00:03 <DIR> TestTwo
0 File(s) 0 bytes
5 Dir(s) 21,313,839,104 bytes free

C:\Documents and Settings\Jon\workspace>cd JavaDev

C:\Documents and Settings\Jon\workspace\JavaDev>dir
Volume in drive C has no label.
Volume Serial Number is D80F-8634

Directory of C:\Documents and Settings\Jon\workspace\JavaDev

17/05/2011 10:12 <DIR> .
17/05/2011 10:12 <DIR> ..
09/04/2011 19:14 <DIR> corejava8
04/05/2008 14:21 2,469 Java CLI.lnk
20/04/2008 12:44 241 Java Platform SE 6.url
17/05/2011 14:11 <DIR> myCode Snippets
2 File(s) 2,710 bytes
4 Dir(s) 21,313,839,104 bytes free

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09>cd FileChooserT
est
...

21/05/2011 19:29 <DIR> .
21/05/2011 19:29 <DIR> ..
21/05/2011 19:23 1,685 Command Prompt.lnk
21/05/2011 19:24 29 del_class.bat
21/05/2011 19:20 <DIR> horstmann
21/05/2011 19:10 57 JFileChooser.manifest
21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
5 File(s) 1,980 bytes
3 Dir(s) 21,313,839,104 bytes free

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>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 19:21 <DIR> .
21/05/2011 19:21 <DIR> ..
21/05/2011 18:49 1,733 Command Prompt.lnk
21/05/2011 19:30 528 FileChooserTest$1.class
21/05/2011 19:30 426 FileChooserTest.class
21/05/2011 19:22 5,134 FileChooserTest.java
21/05/2011 19:30 677 FileIconView.class
21/05/2011 19:30 1,207 ImagePreviewer$1.class
21/05/2011 19:30 730 ImagePreviewer.class
21/05/2011 19:30 550 ImageViewerFrame$1.class
21/05/2011 19:30 1,272 ImageViewerFrame$FileOpenListener.class
21/05/2011 19:30 2,259 ImageViewerFrame.class
21/05/2011 19:10 57 JFileChooser.manifest
21/05/2011 18:45 57 JFileChooser.mf
13/04/2008 15:06 152 palette.gif
21/05/2011 19:30 827 SingleRootFileSystemView.class
21/05/2011 19:22 1,036 SingleRootFileSystemView.java
15 File(s) 16,645 bytes
2 Dir(s) 21,313,896,448 bytes free

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/Fil
eChooserTest
Caused by: java.lang.ClassNotFoundException: horstmann.samples.FileChooserTest
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.FileChooserTest. Program will
exit.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
\horstmann\samples>cd ..


C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>java horstmann\samples\FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann\samples\Fil
eChooserTest (wrong name: 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: horstmann\samples\FileChooserTest. Program will
exit.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>java horstmann.samples.FileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann/samples/Fil
eChooserTest (wrong name: 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: horstmann.samples.FileChooserTest. Program will
exit.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>echo %CLASSPATH%
.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\P
ROGRA~1\JMF21~1.1E\lib;

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>set CLASSPATH = .

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>java horstmann\samples\JFileChooserTest
Exception in thread "main" java.lang.NoClassDefFoundError: horstmann\samples\JFi
leChooserTest
Caused by: java.lang.ClassNotFoundException: horstmann\samples\JFileChooserTest
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\JFileChooserTest. Program will
exit.

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch09\FileChooserTest
>
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

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
>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [error] error: Class names, 'JFileChooser', are only accepted if annotation processing is explicit