analizando java usando php o java?

I am building a web application which in the back end needs to parse a java file and save certain values in a database. This has to be triggered by the user and set on a schedule.

What is the best way of doing this? Should I do this using php or java? Know how to parse the file in both languages however java has reflection which would make it easier and reduce the likelihood of error however I have no idea now to call a java file from the front end e.g. onclick of a button.

The front end technologies I'm looking to use are html, css, javascript and ajax. I'm not looking to use struts e.t.c as I am not familiar with them and I am limited on time.

Muchas Gracias

preguntado el 02 de julio de 12 a las 21:07

Like you want to look at the contents of a text file that happens to be in the java programming language, find something in the that text file, and save parts of that text file to a database? -

There are some good answers on SO already. This one points to some java source parser:… -

I know how I can parse it in both languages, I just dont know which way wound be the best to use in this particular situation. -

1 Respuestas

Reflection will not help in this case, because you need to parse the code (Java in this case) and interpret as you which. Therefore you will need to build an AST of your file.

AST (Abstract Syntax Tree) could be build in Java using Eclipse JDT. En experto central:


Eclipse JDT is a document model that could be compared to a DOM Tree, with the DOM Tree you can access elements, attributes and so on of an XML. The AST has the same scope, you can access for example the class Name, or methods of that class extracting parameters names and types for each method without instantiate an Object based on that class. Other artefacts like documentation or comments are accessible over JDT.

Reflexión can be applied just in case that you have the class loaded on to some class loader, and even so, there are some information like documentation or parameters names that you cannot access through reflection.

A good start is read this hands post:

And a simple start could be done using the code I posted on this

contestado el 23 de mayo de 17 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.