Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set Servlet classpath in Tomcat temporarily?

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about javac -cp C:\TomCat\lib\servlet-api.jar;. ..., with the ... replaced with your regular compiler flags and arguments?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 50196
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic