cancel
Showing results for 
Search instead for 
Did you mean: 

Finding SDM path dynamically

former_member219446
Participant
0 Kudos

Hi All,

Is there any way to find the sdm path dynamically using java program,

I need to copy files in to the SDM\program directory,how can i findout the sdm root directory path(complete path) using java program.

give me any related links

Thanks in Advance

Regards Srinivas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I'm not sure why would you want to do that but please look at this code which will get you the path.

//Assuming the java class runs on the J2EE (WAS) server

Properties props = System.getProperties();

String j2p = props.getProperty("j2ee.path");

//j2ee.path property is a VM arguament which returns the value for ex: /usr/sap/<SID>/JC<nn>/j2ee

File f = new File(j2p);

String parent = f.getParent(); // value is /usr/sap/<SID>/JC<nn>

String sdm = parent + "/SDM/program";

File sdm = new File(sdm);

Lemme know if it helps.

Thanks,

Rajit

former_member219446
Participant
0 Kudos

Hi Rajit,

Thanks for u r reply,

when ever i run u r program , i got null pointer exception.(java class runs on the WAS server)

String j2p=props.getProperty("j2ee.path");

when i print j2p , it shows "null"

i think that "j2ee.path" property is invalid,

How to see the VM arguments in the WAS

Thanks&Reply

Srinivas

Former Member
0 Kudos

Hi,

You can use any VM parameter which gives you some kind of path that resolves atleast till /<SID>/<JCnn>. Its strange j2ee.path parameter returns null.

Goto http://<your-WAS-server:port/ and click System Information. (You need admin previliges).

Good luck,

Cheers,

Rajit

former_member219446
Participant
0 Kudos

Hi Rajit,

Properties props=System.getProperties();

String path=props.getProperty("com.sap.jvmdir");

I have written a sessionbean -->businessmethod , in that method i written the above code and deploy it in to the server(was).then i will get the F:\usr\sap\J2E\JC00\j2ee\cluster\server0 path successfully.(path contains F:\usr\sap\J2E\JC00\j2ee\cluster\server0 )

But i want to find out the sdm home path using java program (without deploying in to server)

I have written a java program with the above code and save it in to the system(which having WAS) when i run the program i got "null".

Is it possible to get the sdm home path with java program(with out deployment).

can u tell me the procedure

Regards

Srinivas

Former Member
0 Kudos

Hi,

Simple answer is no, unless you run it as part of the WAS JVM. They are the VM runtime properties that are available ONLY when run inside it.

What's your exact requirement? That might help our thinking.

Thanks,

Rajit

Former Member
0 Kudos

Hi Srinivas

When we are runnig a setup file it will check the all service are existed or not

to deploy the ear in to the server.In this process we need the sdm path dynamically.

Presently we are hardcoding the server path and we are installing the .sda and .ear files.

But if the target system is having another server path the intallation will fail.

thanks and regards

Satyam