permaculture playing cards*
The moose likes Beginning Java and the fly likes How to set Servlet classpath in Tomcat temporarily? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to set Servlet classpath in Tomcat temporarily?" Watch "How to set Servlet classpath in Tomcat temporarily?" New topic
Author

How to set Servlet classpath in Tomcat temporarily?

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

I just want to know how to set the servlet class path in tomcat temporarily.. Now I am usig environment variables, but I am happy to set classpath temporarily. This is my Servlet location.

C:\TomCat\lib\servlet-api.jar

Then I like to know, for how long this classpath will exist.
Please help


Are you better than me? Then please show me my mistakes..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Is this for run time or for compile time?

If the former, Tomcat doesn't use the classpath at all so it's not an issue. If for compile time, then using the servlet jars are just like using any other jars.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi Bear Bibeault,

Yes, this is for the compilation. I set the classpath using environment variables but that is not what I need now. I heard there is a way to set the class path temporarily using CMD. How to do that and for how long that path will last?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

How about javac -cp C:\TomCat\lib\servlet-api.jar;. ..., with the ... replaced with your regular compiler flags and arguments?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Rob Spoor wrote:How about javac -cp C:\TomCat\lib\servlet-api.jar;. ..., with the ... replaced with your regular compiler flags and arguments?


Hi! Thanks for the comment. Anyway what about "set classpath ;C:\TomCat\lib\servlet-api.jar" ???

I am trying to use this way because when I set the PERMANENT classpath, all other non web based java programs I created wont run. The simply simply throws "Cannot find File" or something like that. This is not happening only to me, happening to everyone of us in our class, and has happened to all my 3 computers.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

As this is about compiling and not really about servlets or Tomcat, it's been moved to a more appropriate forum.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Bear Bibeault wrote:As this is about compiling and not really about servlets or Tomcat, it's been moved to a more appropriate forum.


Thanks for the help Bear Bibeault.. I really appreciate it...

So, anyone have any more ideas?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38007
    
  22
You can often do more harm than good by setting a system classpath.

Can’t you set a classpath by writing set CLASSPATH=.;c:\etc at the command line? Then you have a classpath for your current session, which will vanish when you close the command line.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Campbell Ritchie wrote:You can often do more harm than good by setting a system classpath.

Can’t you set a classpath by writing set CLASSPATH=.;c:\etc at the command line? Then you have a classpath for your current session, which will vanish when you close the command line.


Finally, the answer I am seeking for... .. Thanks for the help.. Please do me some more favor. Could you please write the complete command? I have given the path of my jar files. Then I can coppy and paste your command and stay away from trouble. Please help..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set Servlet classpath in Tomcat temporarily?
 
Similar Threads
compiling servlets and jsp and running in tomcat
Unable to Run A Java Program Thar uses java.util.regex package
Problem in the compilation of the servlet using the classpath in the command line
Tomcat with servlet
Tomcat start-up error and setting CLASSPATH permanently