How to get current EAR location programmatically with JBoss

ptdev picture ptdev · Aug 5, 2009 · Viewed 12.2k times · Source

Does anyone know how to get programmatically the absolute path in the filesystem for an EAR deployed in JBoss, from Java code within that same EAR?

I need this because I want to copy some files that are inside the EAR to another part of the filesystem, on deploy-time.

Thank you everyone!

Answer

douarbou picture douarbou · Mar 26, 2013

you can do you "System.getProperty()" here is the link for other the properties you can used

ex:

String jBossPath = System.getProperty("jboss.server.base.dir")

result

"/Users/ALL_THE_PATH/JBoss_7-1/standelone"

After you just need to add "/deployments/YOUR_PROJECT_EAR/..."