Unable to call dll from Oracle - java

I have a c# DLL, i convert that dll from JNI4net to work with java. I am able to call the dll in java but when i create a jar file and trigger java function from oracle on button event. It throws exception.
Java code:
Bridge.setVerbose(true);
Bridge.setDebug(true);
Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("ECR.j4n.dll"));
ComECR test = new ComECR();
test.VFI_DoSetup();
ORACLE Exception :
java.lang.IllegalArgumentException: URI scheme is not "file"
at java.io.File.<init>(Unknown Source)
at net.sf.jni4net.CLRLoader.findDefaultDll(CLRLoader.java:54)
at net.sf.jni4net.Bridge.init(Bridge.java:31)
at com.ecr.test.Program.getProperty(Program.java:57)
at oracle.forms.handler.UICommon.onGet(Unknown Source)
at oracle.forms.engine.Runform.onGetHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
I have signed jar and also added the jar in class path and formsweb.cfg
need help on this

You have this very message error in SO: URI scheme is not "file"
From your error, I would try the below:
Bridge.setVerbose(true);
Bridge.setDebug(true);
Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("file:<fullpath>/ECR.j4n.dll"));
ComECR test = new ComECR();
test.VFI_DoSetup();
The fact that you're getting the error with Oracle only could mean Oracle doesn't work with same Path as Java alone. It isn't missing the jar file's path but the dll one's.

Related

Unsatisfied Linker Error : library file not found

I am writing test cases for a class that calls the constructor of another class that has a static block that loads a c++ library,
static
{
System.loadLibrary("PixelProxy_jni");
}
I have specified the library path as,
-Djava.libarary.path=C:\Users\Desktop\libPixelProxy_jni.so
in the vm arguments in eclipse, but still it doesn't work.
Please help me find a solution for this
stack trace
java.lang.UnsatisfiedLinkError: no PixelProxy_jni in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.XrayPixelProxyInputStream.<clinit>(XrayPixelProxyInputStream.java:36)
at com.RadImageReader.readImage(RadImageReader.java:57)
at servicedisplay.ServiceImageDisplayer.showImage(ServiceImageDisplayer.java:124)
at servicedisplay.test1.ServiceImageDisplayerTest.testShowImageStringIntIntIntIntIntInt(ServiceImageDisplayerTest.java:95)
From that file path, it looks like you're on windows, which means that loadLibrary will not look for a file named libPixelProxy_jni.so, it will look for a file named PixelProxy_jni.dll. (You can find out exactly what it will look for by using System.mapLibraryName.)
You can either find a .dll of the library, compile one yourself, or try System.load, which allows you to load a native library from an absolute path:
System.load("C:\Users\Desktop\libPixelProxy_jni.so");
But that will only work if the library was actually compiled for windows.

Java 3d error when running application from .jar

Hello when i am running my application from Eclipse it runs perfectly but when i export it as a runnable jar, it doesn't run.
When i try running it from cmd it gives me one of 2 errors the first errror is after i just export it with the "copy required libraries into a sub-folder":
Exception in thread "main" java.lang.UnsatisfiedLinkError: no j3dcore-ogl in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at javax.media.j3d.NativePipeline$1.run(NativePipeline.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.NativePipeline.loadLibrary(NativePipeline.java:180)
at javax.media.j3d.NativePipeline.loadLibraries(NativePipeline.java:137)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:948)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Main.Game.<init>(Game.java:39)
at Main.Main.main(Main.java:6)
when i change the sub-folder's name from IslandDomination_lib to just lib it gives me another error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/Canvas3D
at Main.Main.main(Main.java:6)
Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I have tried running it several ways:
1.
java.exe -jar IslandDomination.jar
2.
java.exe -cp "lib/j3dcore.jar;lib/j3dutils.jar;lib/vecmath.jar" -jar IslandDomination.jar
3. using another java program to run it for me:
package main;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException{
ProcessBuilder pb = new ProcessBuilder(System.getProperty("java.home")+"\\bin\\java.exe", "-cp" , "\"lib/j3dcore.jar;lib/j3dutils.jar;lib/vecmath.jar\"" , "-jar" , "IslandDomination.jar");
pb.directory(new File("./"));
Process p = pb.start();
p.waitFor();
}
}
The internal structure of my jar consists of 4 folders:
J3DBool
Main
Maths
META-INF
The folder with the required jars is in the same folder as the main jar
You use a completely obsolete version of Java3D, which is very difficult to bundle in any software as you have to set the Java library path somehow and you have to bundle both the Java libraries and the native libraries. Rather rebuild your project with Java3D 1.6.0 pre 12, it's a lot easier to use as this version relies on JOGL 2 which uses automatic native library loading and everything is packaged as JARs, there is no longer any need of modifying the library path, just take care of the classpath.
Please follow my tutorial, especially the very last section with (a lot) more information.
Finally, the obsolete version that you use isn't guaranteed to work on any recent operating systems. If it works, you'll be lucky; if it doesn't, nobody will fix it.
I think the required library file (jar file) not found in the classpath.
you need to set Library file in your class path.
step to set class path:-
MyComputer->Properties->Advanced system setting->Environment variables
find "classpath" either in user variables area or in system variables if found edit that and put all the jar file link. if not found then create new(click on new) and put all the jar link there and try to run your application
I found out how to fix my problem and it is done by simply putting the needed dll files next to the executable jar file

JNI UnsatisfiedLinkError dependent libraries

I have a JNI dll along with a jar file that I have created on a machine with eclipse.
I am trying to deploy this to another machine and cannot get past the exception
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\CcmAccess\CcmJNIBase.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Meth
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.sig.ccm.CcmBase.<clinit>(CcmBase.java:8)
at ReadTimeDomain.setupSample(ReadTimeDomain.java:24)
at ReadTimeDomain.main(ReadTimeDomain.java:97)
I have another program that prints out the java.library.path and I have verified the dll that this dll depends on as well as this dll are in the java.library.path.
I have read posts where they should go in the current directory and that doesn't work.
I have read posts where they should go in the jre/bin and that gets the same result.
Any help would be appreciated.
Edit:
If I take everything out of the path and force the classpath to only have the jar file and "." I get the message
Exception in thread "main" java.lang.UnsatisfiedLinkError: no CcmJNIBase in java.library.path
When I add the location of this dll into the path C:\CcmAccess I get the full message:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\CcmAccess\CcmJNIBase.dll: Can't find dependent libraries
On the machine that this seems to work all I had to do was add the dependent dll to my classpath.
Double check your java.library.path value.
Make sure that you are using an absolute path.
Relative paths will make you think your java.library.path is correct, when actually it is actually incorrect.
If you are adding "." in your java.library.path, then you need to double check the "current working directory" when you execute your code.
If you need to use a relative path in your java.library.path, make sure that the path is relative from the "working directory" when you execute your code.

Open an eml file with java in linux

I am trying to open my created .eml file with java in linux. Currently I am using the following command:
Desktop.getDesktop().open(emlFile);
I create the eml file as shown in this example.
This works for my windows system, but an error occurs in linux ubuntu 12.04.
EDIT: error message:
(process:19386): gnome-vfs-modules-WARNING **: Could not initialize inotify
java.io.IOException: Failed to show URI:file:/home/usr/workspace/programm/eml/mail.eml
at sun.awt.X11.XDesktopPeer.launch(Unknown Source)
at sun.awt.X11.XDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
I am happy for any help!
From the docs java.awt.Desktop.open(File)
Throws IOException - if the specified file has no associated
application or the associated application fails to be launched

Eclipse / Java path problems

I'm currently following the third tutorial listed here: here
where I'm trying to compile some matlab code into Java classes. Creating a project in eclipse, and correctly linking the libraries (exactly how its done in the tutorial). Everything actually compiles, but when I run the program I get an Unsatisfied Link error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: C:\Program Files\MATLAB\R2009b\bin\win32\BuilderJABootstrap.dll
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1571)
at com.demo.DemoMCRFactory.<clinit>(DemoMCRFactory.java:100)
at com.demo.MLTestClass.<init>(MLTestClass.java:62)
at Driver.main(Driver.java:16)
The troubling part is the Can't load library: as the path provided '\win32' is not a legitimate path on my computer as I have a 64 bit machine, so the dll is located at \win64. However, I've triple checked all my Environmental variables and am kind of stuck. Could I be using a 64-bit version of matlab, with a 32-bit library?
Thanks!
ChrisH's solution was it

Categories

Resources