开发者

Multiple languages used in one eclipse project

开发者 https://www.devze.com 2022-12-27 01:33 出处:网络
I was wondering whether it was possible f开发者_运维问答or projects in Eclipse to have multiple languages associated with them, specifically PHP and Java. The purpose of this is that I\'d like a commo

I was wondering whether it was possible f开发者_运维问答or 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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号