0

I noticed that when running a Java application or unit test in Eclipse, it explicitly adds the jars of the JRE (rt.jar, etc.) to the -classpath argument of java.

First question: Why? This seems unnecessary, since those jars are implicitly on the bootstrap classpath anyway, right?

Second question: Is there a way to prevent Eclipse from doing that? I found that I can remove those jars from -classpath by deleting the "JRE System Library" from the "Bootstrap Entries" in the Classpath tab for a specific run configuration, but I would like to configure this for the whole project, no for every run config separately.

rolve
  • 10,083
  • 4
  • 55
  • 75
  • Never worked with Bootstrap but did you try remove the jre from window -> preferences -> installed jres ?I would assume if eclipse doesn't have any jres/jdks registered, it wouldn't add them to the libraries either? – Basti Mar 20 '18 at 17:15
  • @Basti Thanks for the suggestion, but I think this would create more problems than it would solve. :D – rolve Mar 20 '18 at 17:32
  • Not if you include the necessary libraries using some other tool like Bootstrap for example. In some of my maven-projects the parent is a pure container for the children. I usually remove the jre from it compleatly and don't run into any problems. Try it. If eclipse explodes, we know better next time :P – Basti Mar 20 '18 at 17:42

0 Answers0