• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can i get a resource using relative path ?  RSS feed

 
Eusebio Floriano
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I would like that my app could get a resource that is out of my ear but
using a relative path.
For example,
if my app is deployed in "c:\jboss-4.0.0\server\myapp\deploy", i would like to
access "c:\jboss-4.0.0\sever\myapp\conf\blabla".
But if using the relative path is "c:\jboss-4.0.0\bin", right ? So, how to get the information that my application is running on the context "myapp" ?
As these resources are not in my classpath, i can�t use


Does anyone know how to help me ?

Regards,
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you looking for the home folder of your server? This is going to return you the home folder of your server:


So if you have deployed the application in C:\jboss\server\myapp\deploy\xyz.ear, then the above property is going to return you C:\jboss\server\myapp. Is this what you are looking for?
 
Eusebio Floriano
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran,

It was exactly what i was looking for.
Thank you very much.

Regards,
 
subodh axe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:Are you looking for the home folder of your server? This is going to return you the home folder of your server:


So if you have deployed the application in C:\jboss\server\myapp\deploy\xyz.ear, then the above property is going to return you C:\jboss\server\myapp. Is this what you are looking for?


how can i get the same for server installed in linux?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code remains the same irrespective of the operating system. The value returned will correspond to the path where the JBoss AS is installed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!