No Ocijdbc18 In Java Library Path Mac

其中涉及的测试源码如下:

For those who didn't install Java with default settings, a systematic way for solving JNI class path problem is:
1> include 'System.out.println(System.getProperty('Java.library.path')); ' in your 'static' block, right before loading the class.
2> run your program and not surprisingly you got the err again, but this time with java.library.path info for your system. (it's important since this path name varies among systems).
3> cp your libxxx.so into the java.library.path

Just for clarity for anyone else having this issue - I am using Oracle SQL Developer 19.2.1, and for me the Database:Advanced dialog asks for the path to the TNSnames file, which is my case was: C: Oracle Product 11.2.0 Client32 Network Admin After that I was able to select the right TNS entry in the connection dialog, and everything worked ok. Important: Setting the PATH environment variable from a MS-DOS command prompt has no effect on java.library.path. For example, this does not work: set PATH=c:chilkatJava;%PATH% java Test Also, modifying the java.library.path from within Java code does not work either. Free, light-weight, and easily installed Oracle Database tools, libraries and SDKs. Oracle Instant Client enables development and deployment of applications that connect to Oracle Database, either on-premise or in the Cloud. If you are explicitly providing java.library.path then also provide it there e.g.-Djava.library.path=C: Programs Oracle ora11g bin ocijdbc11.dll. By the way, if you truly want to learn Java database programming from scratch, I suggest you take a look at the Complete JDBC Programming course on Udemy. This course explains every important detail.

Java一般使用两个path:classpath 和 java.library.path

classpath是指向jar包的位置

java.library.path是非java类包的位置如(dll,so)

解决办法:

第一种方法,在代码里设置环境变量

第二种方法:执行时在vm arguments里添加-Djava.library.path= /usr/local/lib,例如java -Djava.library.path=. xxx(xxx是某个类文件的名字,不包括后缀)

第三种方法:设置环境变量java.library.path

1:Linux下的系统变量LD_LIBRARY_PATH来添加java.library.path

2:Windows下设置哪个环境变量???????????????????

如果你上面看不懂的话就继续向下面看:
1、 在你载入jni类之前 放入“System.out.println( System.getProperty('java.library.path'));
2、运行你的程序你将获得java.library.path指向的目录
3、拷贝你的libxxx.so到java.library.path指向的某个目录下面。
注意:
Linux下:一定要将Linux下的共享库(我暂且这么叫:)命名成libxxx.so的形式,'xxx'是你在System.loadLibrary('xxx')中用到的加载库名称。

Windows下:一定要将Windows下的共享库(我暂且这么叫:)命名成xxx.dll的形式(没有前边的lib三个字母),'xxx'是你在System.loadLibrary('xxx')中用到的加载库名称。

Blur game download for pc. 查了其他的资料:
也可以通过设置LINUX下的系统变量LD_LIBRARY_PATH来添加java.library.path,只要在启动~/.bashrc中添加如下代码然后重新登录shell,就可以将动态库放在当前目录下运行你的jni程序了。
export LD_LIBRARY_PATH=.:.:$LD_LIBRARY_PATH

另外也可以通过如下I'm new to JNI. I see there are several ways to set JVM to look for libraries dll, so, etc.

System.setProperty('java.library.path', '.');
System.loadLibrary('hello');
That's when UnsatisfiedLinkError

No Ocijdbc18 In Java Library Path Mac Os

java.lang.UnsatisfiedLinkError: no hello in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at HelloWorld.main(HelloWorld.java:17)

No ocijdbc18 in java library path macbook
posted @ 2016-11-28 19:11LiuYanYGZ 阅读(20781) 评论(0) 编辑收藏
Hi,
Thanks for the reply. I'm using OCI, Could you please advice what other libraries I will need to add? I couldn't find a place to attach Server.xml file, So I had to copy it here.
Thanks.
S.J
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the 'License'); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Server port='8005' shutdown='SHUTDOWN'>
<Listener className='org.apache.catalina.core.AprLifecycleListener' SSLEngine='on' />
<Listener className='org.apache.catalina.core.JasperListener' />
<Listener className='org.apache.catalina.core.JreMemoryLeakPreventionListener' />
<Listener className='org.apache.catalina.mbeans.GlobalResourcesLifecycleListener' />
<Listener className='org.apache.catalina.core.ThreadLocalLeakPreventionListener' />
<GlobalNamingResources>
<Resource auth='Container' driverClassName='com.mysql.jdbc.Driver'
maxActive='20' maxIdle='10' maxWait='-1' name='jdbc/spagobi'
password='xxx' type='javax.sql.DataSource'
url='jdbc:mysql://localhost:3306/spagobi' username='xx'/>
<Resource name='UserDatabase' auth='Container'
type='org.apache.catalina.UserDatabase'
description='User database that can be updated and saved'
factory='org.apache.catalina.users.MemoryUserDatabaseFactory'
pathname='conf/tomcat-users.xml' />
<Environment name='spagobi_resource_path' type='java.lang.String' value='${catalina.base}/resources'/>
<Environment name='spagobi_sso_class' type='java.lang.String' value='it.eng.spagobi.services.common.FakeSsoService'/>
<Environment name='spagobi_service_url' type='java.lang.String' value='http://localhost:8080/SpagoBI'/>
<Environment name='spagobi_host_url' type='java.lang.String' value='http://localhost:8080'/>
<Resource name='jdbc/bidb' auth='Container'
type='javax.sql.DataSource' driverClassName='com.mysql.jdbc.Driver'
url='jdbc:mysql://localhost:3306/bidb'
username='xx' password='xx' maxActive='20' maxIdle='10'
maxWait='-1'/>
<Resource name='jdbc/piers' auth='Container'
type='javax.sql.DataSource' driverClassName='oracle.jdbc.driver.OracleDriver'
url='jdbc:oracle:oci8:@pdeai'
username='xxxx' password='xxx' maxActive='20' maxIdle='10'
maxWait='-1'/>
<Resource name='jdbc/foodmart' auth='Container'
type='javax.sql.DataSource' driverClassName='com.mysql.jdbc.Driver'
url='jdbc:mysql://vmx9116.cofc.gov.calgary.ab.ca:3306/sifoodmart'
username='xxxx' password='xxxx' maxActive='20' maxIdle='10'
maxWait='-1'/>
<Resource name='jdbc/bam' auth='Container'
type='javax.sql.DataSource' driverClassName='com.mysql.jdbc.Driver'
url='jdbc:mysql://localhost/bam'
username='xxxx' password='xxx' maxActive='20' maxIdle='10'
maxWait='-1'/>
<Resource auth='Container' factory='de.myfoo.commonj.work.FooWorkManagerFactory'
maxThreads='5' name='wm/SpagoWorkManager'
type='commonj.work.WorkManager'/>
</GlobalNamingResources>
<Service name='Catalina'>
<Connector port='8080' protocol='HTTP/1.1'
connectionTimeout='20000'
redirectPort='8443'
URIEncoding='UTF-8'
/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port='8009' URIEncoding='UTF-8' protocol='AJP/1.3' redirectPort='8443' />
<Engine name='Catalina' defaultHost='localhost'>
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className='org.apache.catalina.realm.LockOutRealm'>
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key 'UserDatabase'. Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className='org.apache.catalina.realm.UserDatabaseRealm'
resourceName='UserDatabase'/>
</Realm>
<Host name='localhost' appBase='webapps'
unpackWARs='true' autoDeploy='true'>
<Valve className='org.apache.catalina.valves.AccessLogValve' directory='logs'
prefix='localhost_access_log.' suffix='.txt'
pattern='%h %l %u %t '%r' %s %b' />
</Host>
</Engine>
</Service>
</Server>

No Ocijdbc18 In Java Library Path Machine

This message was edited 1 time. Last update was at 22/06/2015 16:03:40