0

I was trying to make an application wherein i can modify the code already written, compile and run the same from within the web application.

Example, i have a java file, compiled it but during execution i found out that there is some error, i change it within the application, compile the new code and then use the newly written code.

The way to go for this, which i was thinking was with JavaCompiler.

Now i am able to find a lot of examples and i am successfully able to generate the class file and load it at run time also.

But when i try to do it in a web application, it is making the class file in Eclipse root directory.

I want to compile the class file at a certain location(preferably build/classes.... etc)

Any suggestions shall be welcome !

Thanks !

Rishabh Toki
  • 58
  • 10
  • request.getContextPath() will give you location till your root of Project than make specific path as you want like.. request.getContextPath()/resources/classes .. etc – Darshit Feb 27 '17 at 14:15
  • request.getContextPath() gives me the root of my application but the pointer is still to D:/eclipse and if i give the path like /build/classes its still not able to find the directory structure because the pointer is still on D:/eclipse. Now i cant give absolute path as it will RUIN the project. I wont know what will be the root at other location where application is deployed and noone will tell me – Rishabh Toki Feb 27 '17 at 14:42

0 Answers0