Reading the java library path

Questions and answers for all installation-related topics for Servoy products

Reading the java library path

Postby huber » Wed Oct 10, 2012 2:19 pm

Hi All

Is there a possibility to read the java library path within Servoy, i. e. in a Servoy module? Something like the eqivalent of System.getProperty("java.library.path") in Java?
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Reading the java library path

Postby patrick » Wed Oct 10, 2012 2:43 pm

You can use java code directly in Servoy:

Code: Select all
application.output(java.lang.System.getProperty("java.library.path"))
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Reading the java library path

Postby Thomas Parry » Wed Oct 10, 2012 3:16 pm

To supplement Patrick's reply here is a function that I use to figure out all properties:
Code: Select all
function getSystemProperties() {
   /** @type {java.util.Properties} */
   var props = java.lang.System.getProperties();//Properties object returned
   /** @type {java.util.Enumeration} */
   var enumeration = props.propertyNames();
   
   while (enumeration.hasMoreElements()){
      /** @type {String} */
      var prop = enumeration.nextElement();
      application.output('property: ' + prop);
   }
   /** @type {String} */
   var libPath = java.lang.System.getProperty('java.library.path');
   var array_libPath = libPath.split(';');
   for (path in array_libPath){
      application.output('library path[' + path + '] = ' + array_libPath[path]);
   }
   return;
}
Tom Parry
Prospect IT
Java/C++/Servoy/Jasper Reports/Simulation/Service Applications
http://www.prospect-saas.biz
Thomas Parry
 
Posts: 498
Joined: Thu Jan 10, 2008 8:48 pm
Location: Ottawa, Canada

Re: Reading the java library path

Postby Hans Nieuwenhuis » Wed Oct 10, 2012 4:45 pm

Hi,

small change :

If you replace
Code: Select all
      application.output('property: ' + prop);

by
Code: Select all
application.output('property: ' + prop + ' = ' + java.lang.System.getProperty(prop));

it will not just show the key, but also the value of that key

Regards and thanks to Thomas
Hans Nieuwenhuis
Betagraphics
http://www.deltics.nl
http://www.betagraphics.nl

Servoy Version 7.3.1
Java version 1.7.0.x
Database Oracle 11g
User avatar
Hans Nieuwenhuis
 
Posts: 1026
Joined: Thu Apr 12, 2007 12:36 pm
Location: Hengelo, The Netherlands

Re: Reading the java library path

Postby huber » Wed Oct 10, 2012 5:43 pm

Thanks a lot to all of you for the quick reply, that helped a lot in tracking down the problem of not being able to use the SQL Anywhere JDBC4 driver sajdbc.jar, but being able to use the jconn3.jar driver.
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm


Return to Installation

Who is online

Users browsing this forum: No registered users and 5 guests