• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

HFSJ: Error while compiling servlet example

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am currently studying for SCWCD and tried to compile the example on page 176 (the listener test).

I created the java files and first compiled the Dog.java file with



Works fine, Dog.class was created in classes/com/example.

Now I tried to compile src/com/example/MyServletContextListener.java out of the WEB-INF directory with



and I get the following error:



Don't know why Dog class is not found, it is in the same directory.
I think I am just missing sth but I cannot figure out what?

Any ideas?

Thank you!
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Patrick,

You need to add the classes directory to the -classpath on the javac command line, otherwise the compiler won't find Dogs.class when compiling MyServletContextListener.java.

Cheers,
Dagbj�rn
 
Patrick Beck
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help, I tried to concatenate the path to the Dog.class to the classpath, seperated with a semicolon.



The following result:


Well, I do have sufficient access rights.

But then I tried to compile a bunch of java files with "javac ... *java" and now it works.

All 3 files have been compiled and moved to the classes dir.

Don't know what the reason was, but now it works

But thanks for your help!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic