• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set class path during compilation

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai friends ,
I have a program in servelet it displays an error during compilation,the error is,
cz\samba\projects\arc\analyse\AnalyseServlet.java:34: cannot access cz.samba.pro
jects.arc.analyse.sk.skultety.websitexml.WebPageConfig
bad class file: .\cz\samba\projects\arc\analyse\sk\skultety\websitexml\WebPageCo
nfig.class
class file contains wrong class: sk.skultety.websitexml.WebPageConfig
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
private WebPageConfig webPageConfig;
^
1 error
But the class is there in the correct path. Please help me its so urgent
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use SET CLASSPATH =classedirectory
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac -classpath ./sk/skultety/websitexml/ <source>
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the problem is a little bit more than that.
You have the class sk.skultety.websitexml.WebPageConfig
It appears to exist in the directory '.\cz\samba\projects\arc\analyse\' ie a directory relative to somewhere.
The directory '.' is included on your classpath.
When you import it, you are trying to import the class as cz.samba.pro
jects.arc.analyse.sk.skultety.websitexml.WebPageConfig This is not the fuly qualified class name. (see above)
Firstly you need to make sure the directory '.\cz\samba\projects\arc\analyse\' is on your classpath, then refer to class by its correct name.
I think. It's all very confusing.
Another point that needs to be made is that the two examples given above are not the correct way to add classes to the classpath for web applications. You may be better off putting the source in the web-inf\classes directory of the web server.
Dave
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think u are trying to compile it from outside the file dir
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just take some time out and learn how to use ANT to build servlet projects. You will be glad you did. You can completely avoid setting environment variables for specific projects.
Bill
------------
Moose bites can be very painful!
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic