Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This doesn't make a lot of sense. </p> <p>If the classes are needed to compile the project, then there are likely to be static dependencies on them in other classes. (Otherwise ... you would be able to just delete it / them.) </p> <p>But if there are static dependencies on those classes, then you won't be able to run the applications unless those classes are present in the JAR file. If you leave the classes out of the JAR to stop people using them (or whatever), your application will die on startup with "class not found" exceptions.</p> <p>If you want to stop people using the classes directly, you could try the following:</p> <ul> <li><p>Change the classes access to "package private". This doesn't make it impossible to use them, but it makes it more difficult.</p></li> <li><p>Change your project so that the dependencies on the classes are entirely dynamic; e.g. via <code>Class.forName(...)</code> or dependency injection. Then you can exclude the classes from the JAR as required. But once again, if your application needs to use the classes, they have to be accessible at runtime (somehow), and it will therefore be possible (somehow) for other people to get hold of them.</p></li> <li><p>Change your project to allow you remove the classes entirely. This is the only sure-fire solution.</p></li> </ul> <p>Finally, before you go to all of this trouble you should ask yourself why you are even bothering to do this. Why don't you just let people use the classes anyway? What is to stop them getting the classes from somewhere else ... or implementing their own versions from scratch?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload