Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current EAR location programmatically with JBoss

Tags:

java

jboss

ear

seam

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!

like image 683
ptdev Avatar asked Aug 05 '09 16:08

ptdev


People also ask

Where is JBoss deploy directory?

Deploying on a running JBoss Web server WAR is dropped into the ${jboss. server. base. dir}/standalone/deployments/ directory it will be deployed automaticly.

Where can I find war file in JBoss?

The uploaded war is stored in a file called /data/content/ad/xxxxx/content where xxxxx is some temporary directory name. When JBoss is running the exploded contents of your war will be in the /tmp/vfs/temp/tempxxxxxxx/content-yyyyyyy where xxxxxxx and yyyyyyy are random hex values.


1 Answers

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/..."

like image 90
douarbou Avatar answered Sep 22 '22 16:09

douarbou