On Mar 1, 6:48 pm, [email protected] wrote:
> On Mar 1, 6:52 pm, Anton Shaykin <[email protected]> wrote:> Please 
> take a look at this picture:
> > [url=http://www.freeimagehosting.net/][img]http://www.freeimagehosting.net/uploads/e152ac2528.jpg[/img][/url]
> > I tried everything, but it doesn't work. And I believe I shouldn't be
> > currently in "C:\Java Programs\Classes" directory to run the class,
> > because if so, why setting CLASSPATH variable at all? I believe the
> > only value of doing so is a possibility to run your programs, no
> > matter what directory you're currently in. Am I wrong?
>
> I believe so too. My Hello runs fine in another directory. Perhaps you
> could specify the classpath explicitly like this:
> C:\Java Programs\Sources>java -cp ..\classes Hello
>
> > Another issue is that I don't see CLASSPATH in the list of
> > enviromental variables, is it OK (see picture attached)?
> > [url=http://www.freeimagehosting.net/][img]http://www.freeimagehosting.net/uploads/49d954a64e.jpg[/img][/url]
> > Thanks for any help!
>
> > On Mar 1, 6:10 am, [email protected] wrote:
>
> > > I believe it has not been compiled.
>
> > > On Mar 1, 5:11 am, Anton Shaykin <[email protected]> wrote:> After 
> > > successfully setting up classpath using
> > > > set CLASSPATH = C:\Java Programs\Classes
> > > > and putting .class file into that directory I still get an exception
> > > > java.lang.NoClassDefFoundError
> > > > What could be the possible solution?
> > > > Even after typing "set CLASSPATH" I see exactly this directory
> > > > displayed. And I'm positive there's a Hello.class file in it. But
>
> > > You can confirm it is there at cmd by:
> > > C:\Java Programs\Classes>dir
>
> > > > every time I type "java Hello" I get the same error.
> > > > Any help?
>
>

I think you have to specify the class you have to run. Assume u have 2
directories in your classpath and both have same file to run but with
a bit different implementation. JVM has to know which file to run.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to