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

  • SEARCH
  • Home
  • 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 8100175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:40:35+00:00 2026-06-05T22:40:35+00:00

We are building an engine that will allow us to add new jar files

  • 0

We are building an engine that will allow us to add new jar files whenever, load those jar files and look for some specific functionality, and run the code that exposes that functionality. Current plan is to use the ServiceLoader to do so (just an extra detail; I’m not married to that idea). For the moment let’s assume that we completely control which jar files are going to be loaded (big assumption–I’d guess I’m going to eventually post something about that too).

Given all that, I would like to restrict access in those extensions to certain classes. For a fake example, we want to ensure that instead of using java.io.PrintStream, they use our.better.PrintStreamSolution.

I really don’t have a good idea of what I could do here. Since for the time being, we own the code that will go out as extensions, we could just do very thorough code reviews but I’d rather do either a static analysis at install time or actually throw errors at runtime. Any idea how one would would accomplish this?

  • 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-06-05T22:40:38+00:00Added an answer on June 5, 2026 at 10:40 pm

    You would need to whitelist the APIs. Reflective APIs appear all over the place, so you can’t realistically blacklist. To do this, you’d need to go through the jars using a library such as ASM. Whilst you could use URLClassLoader with a custom URL connection handler, I would suggest a custom class loader. I strongly suggest avoiding anything to do with global state, such as ServiceLoader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a site on the new Razor engine that comes with MVC 3
So i have been building an AR engine that makes use of the magnetic
I'm building an app on Google App Engine. I'm incredibly new to Python and
I am thinking about building a small robot that will drive around, judge distance
We're building a site that will have very minimal code, it's mostly just going
I'm building a Google App Engine web app, with a Java back end, that
I am building an App Engine app that uses OAuth to get a user's
I'm building a small application that will crawl sites where the content is growing
I'm building a small specialized search engine for prise info. The engine will only
I am building a template engine with the concept that i learnt from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1433&lngWId=8

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.