Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Java needs classpath at runtime

In Java we set the classpath at compile time to compile Java files, but why do we need to set the classpath at runtime? Any specific reason why the JVM needs the classpath to run .class files?

like image 403
Meet Avatar asked Sep 01 '25 02:09

Meet


1 Answers

The files on the classpath provide the actual executable code (in Java .class files) that the JVM needs to run.

like image 153
chrylis -cautiouslyoptimistic- Avatar answered Sep 02 '25 14:09

chrylis -cautiouslyoptimistic-