views:

30

answers:

2

I was wondering whether it was possible for projects in Eclipse to have multiple languages associated with them, specifically PHP and Java. The purpose of this is that I'd like a common 'properties' file for the two projects.

If instead there's a way to hold a relative reference to a file so that both projects can reference the properties file, that will work too.

A: 

You could just place the properties you want the two languages to share into a plain text file. Then code a PHP file to read the plain text file, and code a Java file to read the plain text file. Be careful if you plan on having your two projects edit said-file though. If there's any chance that both of them could be editing the file at the same time, you're in trouble.

KSwift87
The idea is that if someone else checks out the projects, there's one central file that needs to be changed that will reflect on both projects.
tipu
A: 

Part one of the question

whether it was possible for projects in Eclipse to have multiple languages associated with them, specifically PHP and Java

No, a project in eclipse is language dependent. You could technically write some source in another language and then use another build method to compile from the secondary language - Not recommended !!!

For the second part of the question ...

Common Property files

Create another project and in that project put a java properties file. Have both projects (Java and PHP) read the property file from here (In Java just add where you put the file as part of the classpath) In PHP use this Java properties reader If you are careful on how you write the Java properties file you could also use parse_ini_file

Romain Hippeau
That's how I am going to do it, create a third project that just has the properties file. Thanks!
tipu