Re: Jar in classpath but still class not found
Lew wrote:
On Apr 16, 11:19 am, Piotr Kobzda <pi...@gazeta.pl> wrote:
Philipp wrote:
Thanks for the ansnwer, but this does not solve the problem! I still
get
$ java -cp .:Printer.jar PrintTest
Exception in thread "main" java.lang.NoClassDefFoundError: PrintTest
[...]
It seems to me you are using Windows. So, you should use a semicolon
(not a colon) as the classpath entries separator.
On what are you basing the idea that the OP is using Windows?
Lars answered this question in part (I checked the OP's postings headers).
There is absolutely no evidence in this thread that he is.
Of course, there is no evidence.
However, the OP said that the following fails:
$ java -cp Printer.jar PrintTest
when the following works:
$ java -Xbootclasspath/a:Printer.jar PrintTest
The latter suggests that there is PrintTest.class in the default
classpath (which typically is current working directory).
Moreover, the solution suggested later by John, i.e.:
$ java -cp .:Printer.jar PrintTest
wasn't helpful as it possibly could be on the *nix platforms. This
caused my suspicion, that the OP uses Windows. This suspicion was in
part ensured to me not only with the OP's posts headers, but also with
the results of applying the suggestion, and the OP's use of word
'folder' (most *nix oriented people use 'directory' instead).
Hope it explains the way of approaching my hypothesis? :)
BTW, another reason of the OP's problem could be explicitly set
CLASSPATH environment variable to the one containing directory where
PrintTest.class resides. But as we know now, it wasn't the case.
piotr