File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set class path during compilation

 
Jithesh Kozhipurath
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use SET CLASSPATH =classedirectory
 
Tom Blough
Ranch Hand
Posts: 263
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac -classpath ./sk/skultety/websitexml/ <source>
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
ramdas pradeep kumar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think u are trying to compile it from outside the file dir
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic