Home > other >  how to change classpath on tomcat using mac os
how to change classpath on tomcat using mac os

Time:09-02

I'm trying to edit tomcat's classpath. My school ordered to me, create classfiles into classes folder. That's why I need to change CLASSPATH to classes folder in tomcat.

I tried to change classpath like this

  1. vi ~/.bash_profile
  2. edit this file

export CLASSPATH=${CLASSPATH}:/Users/seok/Desktop/apache-tomcat-8.5.82/webapps/ROOT/WEB-INF/classes; 3) save and exit

But, when I restarted tomcat, CLASSPATH didn't change.

Using CLASSPATH: /Users/seok/Desktop/apache-tomcat-8.5.82/bin/bootstrap.jar:/Users/seok/Desktop/apache-tomcat-8.5.82/bin/tomcat-juli.jar

Thank you for reading my English even though it was a mess. Please help me guys

CodePudding user response:

A web application (in your case ROOT) automatically includes its WEB-INF/classes folder in its classpath. There's no need to edit anything, and anything you do to a CLASSPATH variable doesn't have an effect within tomcat anyway: Classloading within tomcat happens according to the servlet specification, not according to arbitrary settings of environment variables.

As long as you're intending to edit the classpath of your ROOT application (served on the root, /, of your server (typically http://localhost:8080/) there's nothing else that you need to do.

  • Related