0

I am creating a system that will compile first and second year java programs, at the moment I have it compiling single Java files.

As I was starting to try and get the system to compile projects with multiple classes, it accord to me that being first and second year students they are not going to hand up the projects all in the same format.

I was trying to research this all yesterday but could not find out much of about things like:

  • What are to main differences between Netbeans and Eclipse projects when compiling
  • How to compile projects in jar files
  • Just the different formats in general

So my question is, is there a compiler out there that compiles all the different formats, or do you have to set up the different formats to a certain way to compile them?

Any examples of this as well?

Vijay Chavda
  • 826
  • 2
  • 15
  • 34
newSpringer
  • 1,018
  • 10
  • 28
  • 44
  • I assume, you are a teacher? Get them (and yourself, in case you don't already know it) to know [Maven](http://maven.apache.org/), and accept only valid maven projects. It will do good both to you, and them as future programmers. – npe Jun 06 '12 at 16:54
  • No im not a teacher but i am developing this for a teacher who wants to make the whole correcting process a bit easier. The teacher i am creating this for is not big into the whole idea of Maven as he said he wants to teacher them Java Programming and get the basic understanding of how everything works before moving onto something like Maven so he so does not want it done this way... to be honest i do not think he wants to specify one way to submit assignments which is my problem which im trying to figure out – newSpringer Jun 07 '12 at 08:07
  • Then I guess you have a hard piece of work to do. You could do ant, but still will have to somehow extract the `classpath` entries from all the possible project files (Eclipse, Idea, JBuilder, JDeveloper, etc). Not to mention homeworks returned with grails/ivy/ant/maven/buildr scripts. I seriously suggest that your fiend enforce some standards - if not maven, then maybe "Eclipse projects only". – npe Jun 07 '12 at 09:10
  • Ya id say i will, because this is only one of the many functions he wants the system to be able to do so I am just going to have to set it as one project type only – newSpringer Jun 07 '12 at 13:07

2 Answers2

0

Make it a requirement to use Maven to build (yes it has it's faults, but at least you'll get consistency).

Matt
  • 11,523
  • 2
  • 23
  • 33
0

What I understand is you want something that can compile all types of Java projects (NetBeans, Eclipse, etc.)

Sorry to say this but there isn't one that can compile all the formats out there. But you could write your own, for at least the most common types of formats that you receive from the students.

Check out this page for more information: Building Java Projects.

What I suggest is, start by studying the build architecture used by those tools (NetBeans, Eclipse, etc.) and come up with a build script of your own that can extract the class paths of all the classes in the java project. Let your script do the work for you!

If you don't wish to write your own scripts, then you may consider changing the projects you receive into a standard project format. Check out this and this link to see more about migrating from Ant to Maven or Maven to Ant.

Else, you can always manually port your existing projects into other IDE, provided they follow the same build mechanism. Check out this answer to know more.

Community
  • 1
  • 1
Vijay Chavda
  • 826
  • 2
  • 15
  • 34