cancel
Showing results for 
Search instead for 
Did you mean: 

java.library.path

Former Member
0 Kudos

I want to change the java.library.path property of VM permanently, thus I used the java command with -D option just like below, with no new-line entered:

java -Djava.library.path=/usr/java14_64/jre/bin:/usr/java14_64/jre/bin/classic:/usr/java14_64/jre/bin:/usr/sap/XID/SYS/exe/run:/usr/sap/XID/SYS/exe/runU:/db2/db2xid/sqllib/lib:/usr/lib:/opt/IBM/cicstg/bin

but after doing this, the following infomations appears in console, just like I've just enter "java":

Usage: java [-options] class [args...]

(to execute a class)

or java [-jar] [-options] jarfile [args...]

(to execute a jar file)

where options include:

-cp -classpath <directories and zip/jar files separated by 😆

set search path for application classes and resources

-D<name>=<value>

set a system property

-verbose[:class|gc|jni]

enable verbose output

-version print product version

-showversion print product version and continue

-? -help print this help message

-X print help on non-standard options

-assert print help on assert options

And the last path - /opt/IBM/cicstg/bin still hasn't been added to java.library.path property.

Any ideas? Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi YiNing,

Other way for setting java path:

Right click on MyComputer->Advanced->Environment variable

JAVA_HOME=c:\j2sdk1.4.2_11

PATH=%JAVA_HOME%\bin;<remaining path>

Regards, Suresh KB

Former Member
0 Kudos

Suresh, I tried your method in windows but it doesn't work.

I write a java code to get the java.library.path property.


import java.util.Properties;
class  GetProperty
{
	public static void main(String[] args) 
	{
		Properties props = System.getProperties(); 
		System.out.println(props.getProperty("java.library.path"));
	}
}

Besides, our system is AIX UNIX, and I've add the path to LD_LIBRARY_PATH, but still, I can't seen it in java.library.path:(

Former Member
0 Kudos

Hi,

do you want to set the java.library.path variable for stand-alone applications or for the Web Application Server?

For the Web Application Server you can set these information in the config tool.

Regards

Sebastian

Former Member
0 Kudos

Sebastian, I want set it for WAS, can you tell me the detail of the setting in config tool?

Thank you!

Former Member
0 Kudos

Hi,

how to change / update the java options is documented in SAP note 710146, which basically says :

go to something like

C:\usr\sap\<id>\<instance>\j2ee\configtool,

start the configtool.bat (.sh on unix), select

cluster_data/instance_ID.../server_ID... and make the change in the "Java parameters" field. Do this for all servers and dispatchers, click the save button and restart the whole cluster

However modifying the library path of the whole java and the server, may lead to some quite strange results, and I assume you want to make your dll available only for some application, right ? So maybe a better approach is to package your resources together with your application and deploy, although I am not sure how or if that could be done with native libraries.

Probably search in the documentation or opening another message with appropriate subject may help.

HTH

Peter

Former Member
0 Kudos

Peter, my EJB deployed onto the SAP J2EE Engine refers certain JARs of IBM application, which uses the JNI technology. I found the path is not in java.library.path property, and that's why I want to add the path into it.

I'll try the config tool tomorrow.

Anyway, thank you:)

Former Member
0 Kudos

Hi,

So there are some native libraries used by the IBM guys, but they cannot be loaded ?

I don't have any JNI experience, but maybe if the native resources used by the IBM code is in the classpath, that will do the trick... and simply adding this to the application (at the root level, without package) is something that could be tried...

Or perhaps deploying the IBM jars and their resources as a library on the server and using them from your application...

Here is a thread that discusses server libraries and somewhat similar problem,

HTH

Peter

Former Member
0 Kudos

Peter, the library files is generated with the installation of a IBM product.

Unfortunely, we forgot to use ther user <sid>adm to install the product, thus, some system environment is not set properly, and java.library.path is one of them.

I've theck the configtool, the setting in it is a command line, and -Djava.library.path can be added to there, but as you said, it's dangerous, so I haven't tried it.

Anyway, thank you:)

My last question is, still as the first one, <b>why can't I use java -D option in console? Even in my windows console?</b>

Former Member
0 Kudos

Hi,

the java -D options is NOT to setup something permanently as it seems you are expecting, but to set something for the current invocation. The message you get is that you need to provide a class with main method together with the launch options. I.e. if you invoke

java -Djava.library.path=myPath GetProperty

where GetProperty is your class you should see the correct value, but if you launch it the next time :

java GetProperty

you should see again the old value.

Hope that explains it a bit.

Peter

Former Member
0 Kudos

Peter, that's what I want, thank you:)

Answers (0)