3

I mean, I want a developer to be able to check out a project and not have to change anything to in order to get it to build and run. One problem I have run up against is that the proper compiler has to be added to the Build Path -- is there a way this can be done? I realize that the actual JDK will still have to be downloaded but could it be clear from looking at Eclipse which JDK is needed?

Jeff
  • 1,513
  • 4
  • 18
  • 34
  • Ey Jeff... what do you mean about "check out a project". Eclipse will always require an underlying jdk in order to operate, it is.. as first place, a standard java application that follow the j2se spec i guess. If you like to change the JDK employed you should check post like this http://stackoverflow.com/questions/12588537/how-to-change-jdk-version-for-an-eclipse-project – Victor Jul 06 '15 at 20:28
  • What I mean is, make it possible for both the source (and dependencies) and the full configuration of Eclipse to somehow be recorded so that when a developer wants to start he has no configuration to do. – Jeff Jul 06 '15 at 20:35
  • Well... i guess that eclipse offer several ways to export a project along with all the meta-data required to set up properly the build path in another version of eclipse... although there is no official guarantee that will work on another computer with the same eclipse installed on it, because the real decency is in what java version specification language you are using for compiling (A) and the underlying compiler that you are actually using for compiling and running the project (B). I guess that (A) will be stored on the exported project meta data files. – Victor Jul 06 '15 at 21:05

2 Answers2

2

The build path is usually stored in a file called .classpath under the project directory, consisting of the classpath entries that were added in Eclipse. Among the entries in the file is one which points to the JRE library.

There is no "complete" configuration that can be saved. Every configuration is stored in a separate file. Some are stored in the project directory. Others are stored in the root directory of your workspace. You'd have to pick exactly which configuration you want to save.

One way to save a configuration for the project and its dependencies is to use a project management tool like Maven. It can configure the required JDK to compile the project (it can even enforce this rule), needed dependencies, etc.

M A
  • 71,713
  • 13
  • 134
  • 174
  • yes, maven is being used and if it can solve this problem, I will explore that as the solution. – Jeff Jul 06 '15 at 21:31
0

If you set up your project to use an Execution Environment as its JRE Library (as opposed to the "Workspace default" option), then check in the .classpath and .project files, then checkout is a simple process. Execution Environment is an abstraction of the actual JRE/JDK that's installed on any machine/workspace; Eclipse uses that to map to a physical JDK in whatever workspace it's working in.

As others have mentioned, using Maven (or, even better, Gradle) to manage the dependencies will help, too - as long as every developer has the m2e (Maven integration for Eclipse) features installed into his Eclipse.

E-Riz
  • 31,431
  • 9
  • 97
  • 134