Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1115757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:12:13+00:00 2026-05-17T03:12:13+00:00

I’m trying to practice myself with custom class loaders, and I’ve some questions. Is

  • 0

I’m trying to practice myself with custom class loaders, and I’ve some questions. Is there a way to indicate the JVM to use my custom class loader globally? For example, I wrote small app running under Tomcat 6. The servlet is managed by the container, where should I set my class loader? In addition, the webapp uses some 3rd party jars, can I control the classes loading of those jars?

Are the answers to the above will be different in case of standalone app?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T03:12:13+00:00Added an answer on May 17, 2026 at 3:12 am

    You can set the system default class loader as a JVM argument:

    java -Djava.system.class.loader
        =com.test.YourCustomClassLoader com.test.YourMainClass
    

    As Tomcat starts as a java application, you can set this parameter too, at the %TOMCAT_HOME%\bin\run.bat or $TOMCAT_HOME/bin/run.sh executable.

    Edit for completion:
    If you set your classloader as de System class loader, it will be used to load Tomcat component classes, the different libraries, and your own classes.
    If you want your class loader to be used only for your application classes (including libraries and so), you should configure a Loader element for your context.
    The Loader element must be defined inside your Context element, wich can be defined at a context.xml file.
    More information:

    • Apache Tomcat: Class Loader HOW-TO: defines how the ClassLoaders work in Tomcat.
    • Tomcat Configuration Reference: The Context Container: how to define your Context element
    • Tomcat Configuration Reference: The Loader Component: How to define your custom Loader element for your own Context.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.