aspose file tools*
The moose likes Servlets and the fly likes How to set class path during compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to set class path during compilation" Watch "How to set class path during compilation" New topic
Author

How to set class path during compilation

Jithesh Kozhipurath
Ranch Hand

Joined: Aug 27, 2003
Posts: 76
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


Jithesh K
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

use SET CLASSPATH =classedirectory


Groovy
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
javac -classpath ./sk/skultety/websitexml/ <source>


Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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
ramdas pradeep kumar
Ranch Hand

Joined: Aug 27, 2003
Posts: 36
i think u are trying to compile it from outside the file dir
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
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!
 
 
subject: How to set class path during compilation