1

Are .classpath and .project files as created by Eclipse, only used by Eclipse internally? Are these files being used by JDK? How do Java EE application servers find classes and path?

In between, when I create the ear, war using ant, I will use ant options to look out for the libraries for the project compilation.

Then does the application server use .classpath for compilation?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
devv
  • 311
  • 5
  • 17

2 Answers2

1

Java EE application servers don't need the classpath which we set in Eclipse for the war (web project) to run because while packaging the war, we stuff all the required jar's in the lib folder of the war file. When the application server starts , it loads all the jars from the lib folder without the need for any classpath declaration.

Also, in case any external dependencies are needed, most Java EE servers provide facility to define external jar dependencies.

And yes, .project, .settings folder etc. are all needed by Eclipse to handle the classpath and other settings of your workspace.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Metalhead
  • 1,429
  • 3
  • 15
  • 34
  • Thanks for your clarification. you mean to say that app server loads all the files under WEB-INF/lib folder? And what about ejb,rar class files.As you mentioned, how does the external jar files are referenced?.I remember, in one of my project jars are stored into websphere folders. For running standalone applications , we have to use java -classpath right? – devv Oct 22 '12 at 11:07
  • For standalone application you can check this link -->http://stackoverflow.com/questions/8754948/packaging-of-a-standalone-java-program-built-using-maven or if u r not using maven refer http://stackoverflow.com/questions/564515/package-and-run-a-java-application-with-spring-dependencies – Metalhead Oct 22 '12 at 11:22
1

if we put it simply

.classpath and .project are eclipse metadata files and are used by eclipse only. They are meaning less for other applications.

Mukul Goel
  • 8,387
  • 6
  • 37
  • 77