Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » classpath problem
classpath problem [message #552872] Fri, 13 August 2010 22:32 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi,
this should be trivial, but I'm getting mad :(

I am tring to use Jintilla, which has a couple of dll containing the
editor compnent itself.

I have not found the right incantation to convince my stupid wrapper to
fint them in a dir in my workspace.

I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
directory.
If I place the two diretories there everything is ok.

If I place them anywhere else, even if I modify "java.library.path"
and/or "sun.boot.library.path", explicitly or via IDE settings the
closest I get is:

Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
Routine di inizializzazione della libreria di collegamento dinamico
(DLL) non riuscita
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
at it.condarelli.jintilla.Main.main(Main.java:46)

which seems to indicate the dll is actually found, but something else
coes wrong (perhaps the second one is not found?)

Can someone help me, please?

Thanks in Advance
Mauro
Re: classpath problem [message #552896 is a reply to message #552872] Sat, 14 August 2010 06:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
you need to load them in the correct order. If DLL2 depends on DLL1 you
need to:

System.loadLibrary("DLL1");
System.loadLibrary("DLL2");

If you use Bundle-NativeCode you don't need to modify the java.library.path.

Tom

Am 14.08.10 00:32, schrieb Mauro Condarelli:
> Hi,
> this should be trivial, but I'm getting mad :(
>
> I am tring to use Jintilla, which has a couple of dll containing the
> editor compnent itself.
>
> I have not found the right incantation to convince my stupid wrapper to
> fint them in a dir in my workspace.
>
> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
> directory.
> If I place the two diretories there everything is ok.
>
> If I place them anywhere else, even if I modify "java.library.path"
> and/or "sun.boot.library.path", explicitly or via IDE settings the
> closest I get is:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
> Routine di inizializzazione della libreria di collegamento dinamico
> (DLL) non riuscita
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
> at it.condarelli.jintilla.Main.main(Main.java:46)
>
> which seems to indicate the dll is actually found, but something else
> coes wrong (perhaps the second one is not found?)
>
> Can someone help me, please?
>
> Thanks in Advance
> Mauro
Re: classpath problem [message #552902 is a reply to message #552896] Sat, 14 August 2010 08:48 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Il 14/08/2010 08:28, Tom Schindl ha scritto:
> You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
> you need to load them in the correct order. If DLL2 depends on DLL1 you
> need to:
>
> System.loadLibrary("DLL1");
> System.loadLibrary("DLL2");
>
> If you use Bundle-NativeCode you don't need to modify the java.library.path.

Thanks, will do.
A bit of additional complexity comes from the fact I actually load only
one lib:

static {
System.loadLibrary("scijni");
}

while the other (scilexer.dll) is loaded directly by this lib.

The error I got was due to the fact scijni.dll can't find scilexer.dll.
In order to have it working I need to have scilexer.dll in the PATH.
So there are two different mechanisms for loading the two libs.
That's why I took so long to find out wat was wrong.

A friend of mine said bugs always come in couples... and if you don't
squash them fast enough they spawn!

Is there a way I can modify (progrmmatically or via some XML) the PATH
environment variable for scijni?

>
> Tom
>
> Am 14.08.10 00:32, schrieb Mauro Condarelli:
>> Hi,
>> this should be trivial, but I'm getting mad :(
>>
>> I am tring to use Jintilla, which has a couple of dll containing the
>> editor compnent itself.
>>
>> I have not found the right incantation to convince my stupid wrapper to
>> fint them in a dir in my workspace.
>>
>> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
>> directory.
>> If I place the two diretories there everything is ok.
>>
>> If I place them anywhere else, even if I modify "java.library.path"
>> and/or "sun.boot.library.path", explicitly or via IDE settings the
>> closest I get is:
>>
>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
>> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
>> Routine di inizializzazione della libreria di collegamento dinamico
>> (DLL) non riuscita
>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
>> at it.condarelli.jintilla.Main.main(Main.java:46)
>>
>> which seems to indicate the dll is actually found, but something else
>> coes wrong (perhaps the second one is not found?)
>>
>> Can someone help me, please?
>>
>> Thanks in Advance
>> Mauro
>
Re: classpath problem [message #552915 is a reply to message #552902] Sat, 14 August 2010 13:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Can't you simply include the 2nd one as well in your project?

Tom

Am 14.08.10 10:48, schrieb Mauro Condarelli:
> Il 14/08/2010 08:28, Tom Schindl ha scritto:
>> You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
>> you need to load them in the correct order. If DLL2 depends on DLL1 you
>> need to:
>>
>> System.loadLibrary("DLL1");
>> System.loadLibrary("DLL2");
>>
>> If you use Bundle-NativeCode you don't need to modify the
>> java.library.path.
>
> Thanks, will do.
> A bit of additional complexity comes from the fact I actually load only
> one lib:
>
> static {
> System.loadLibrary("scijni");
> }
>
> while the other (scilexer.dll) is loaded directly by this lib.
>
> The error I got was due to the fact scijni.dll can't find scilexer.dll.
> In order to have it working I need to have scilexer.dll in the PATH.
> So there are two different mechanisms for loading the two libs.
> That's why I took so long to find out wat was wrong.
>
> A friend of mine said bugs always come in couples... and if you don't
> squash them fast enough they spawn!
>
> Is there a way I can modify (progrmmatically or via some XML) the PATH
> environment variable for scijni?
>
>>
>> Tom
>>
>> Am 14.08.10 00:32, schrieb Mauro Condarelli:
>>> Hi,
>>> this should be trivial, but I'm getting mad :(
>>>
>>> I am tring to use Jintilla, which has a couple of dll containing the
>>> editor compnent itself.
>>>
>>> I have not found the right incantation to convince my stupid wrapper to
>>> fint them in a dir in my workspace.
>>>
>>> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
>>> directory.
>>> If I place the two diretories there everything is ok.
>>>
>>> If I place them anywhere else, even if I modify "java.library.path"
>>> and/or "sun.boot.library.path", explicitly or via IDE settings the
>>> closest I get is:
>>>
>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
>>> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
>>> Routine di inizializzazione della libreria di collegamento dinamico
>>> (DLL) non riuscita
>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
>>> at it.condarelli.jintilla.Main.main(Main.java:46)
>>>
>>> which seems to indicate the dll is actually found, but something else
>>> coes wrong (perhaps the second one is not found?)
>>>
>>> Can someone help me, please?
>>>
>>> Thanks in Advance
>>> Mauro
>>
>
Re: classpath problem [message #552918 is a reply to message #552915] Sat, 14 August 2010 13:39 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I don't think so, Tom.

The second dll (scilexer.dll) is not a jni lib, it's a regular C++ dll,
while the first (scjni.dll) is a jni wrapper around it.

I can try to load it, but I do not realy expect it to work.

I would like to further wrap this into a SWT Composite, adding several
controls.

scilexer. dll is the Scintilla editor component and I would like to have
it, together with menu and toolbars in a shrink-wrapped SWT component (I
didn't find anything equivalent so far: StyledText falls very short on
two issues: wordwrap and spellcheck, unfortunately).

That is the reason why I would like to find a way to add to PATH
programmatically and I would like to avoid resorting to command-line
options or similar.

Any suggestion?

Regards
Mauro


Il 14/08/2010 15:13, Tom Schindl ha scritto:
> Can't you simply include the 2nd one as well in your project?
>
> Tom
>
> Am 14.08.10 10:48, schrieb Mauro Condarelli:
>> Il 14/08/2010 08:28, Tom Schindl ha scritto:
>>> You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
>>> you need to load them in the correct order. If DLL2 depends on DLL1 you
>>> need to:
>>>
>>> System.loadLibrary("DLL1");
>>> System.loadLibrary("DLL2");
>>>
>>> If you use Bundle-NativeCode you don't need to modify the
>>> java.library.path.
>>
>> Thanks, will do.
>> A bit of additional complexity comes from the fact I actually load only
>> one lib:
>>
>> static {
>> System.loadLibrary("scijni");
>> }
>>
>> while the other (scilexer.dll) is loaded directly by this lib.
>>
>> The error I got was due to the fact scijni.dll can't find scilexer.dll.
>> In order to have it working I need to have scilexer.dll in the PATH.
>> So there are two different mechanisms for loading the two libs.
>> That's why I took so long to find out wat was wrong.
>>
>> A friend of mine said bugs always come in couples... and if you don't
>> squash them fast enough they spawn!
>>
>> Is there a way I can modify (progrmmatically or via some XML) the PATH
>> environment variable for scijni?
>>
>>>
>>> Tom
>>>
>>> Am 14.08.10 00:32, schrieb Mauro Condarelli:
>>>> Hi,
>>>> this should be trivial, but I'm getting mad :(
>>>>
>>>> I am tring to use Jintilla, which has a couple of dll containing the
>>>> editor compnent itself.
>>>>
>>>> I have not found the right incantation to convince my stupid wrapper to
>>>> fint them in a dir in my workspace.
>>>>
>>>> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
>>>> directory.
>>>> If I place the two diretories there everything is ok.
>>>>
>>>> If I place them anywhere else, even if I modify "java.library.path"
>>>> and/or "sun.boot.library.path", explicitly or via IDE settings the
>>>> closest I get is:
>>>>
>>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
>>>> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
>>>> Routine di inizializzazione della libreria di collegamento dinamico
>>>> (DLL) non riuscita
>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
>>>> at it.condarelli.jintilla.Main.main(Main.java:46)
>>>>
>>>> which seems to indicate the dll is actually found, but something else
>>>> coes wrong (perhaps the second one is not found?)
>>>>
>>>> Can someone help me, please?
>>>>
>>>> Thanks in Advance
>>>> Mauro
>>>
>>
>
Re: classpath problem [message #553107 is a reply to message #552918] Mon, 16 August 2010 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jim.Cooper.sas.com

On Windoze, the current directory is always in the path. Most DLLs also
see the directory they were loaded from.

If you physically include both DLLs in your project in the same
directory (especially in the same directory as the main 'executable',
your problem may be resolved.

Another alternative is to do the LoadLibrary on the scilexer.dll before
the scjni.dll, just so it it will already be in memory (where it should
be found before the path is searched).

On 8/14/2010 9:39 AM, Mauro Condarelli wrote:
> I don't think so, Tom.
>
> The second dll (scilexer.dll) is not a jni lib, it's a regular C++ dll,
> while the first (scjni.dll) is a jni wrapper around it.
>
> I can try to load it, but I do not realy expect it to work.
>
> I would like to further wrap this into a SWT Composite, adding several
> controls.
>
> scilexer. dll is the Scintilla editor component and I would like to have
> it, together with menu and toolbars in a shrink-wrapped SWT component (I
> didn't find anything equivalent so far: StyledText falls very short on
> two issues: wordwrap and spellcheck, unfortunately).
>
> That is the reason why I would like to find a way to add to PATH
> programmatically and I would like to avoid resorting to command-line
> options or similar.
>
> Any suggestion?
>
> Regards
> Mauro
>
>
> Il 14/08/2010 15:13, Tom Schindl ha scritto:
>> Can't you simply include the 2nd one as well in your project?
>>
>> Tom
>>
>> Am 14.08.10 10:48, schrieb Mauro Condarelli:
>>> Il 14/08/2010 08:28, Tom Schindl ha scritto:
>>>> You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
>>>> you need to load them in the correct order. If DLL2 depends on DLL1 you
>>>> need to:
>>>>
>>>> System.loadLibrary("DLL1");
>>>> System.loadLibrary("DLL2");
>>>>
>>>> If you use Bundle-NativeCode you don't need to modify the
>>>> java.library.path.
>>>
>>> Thanks, will do.
>>> A bit of additional complexity comes from the fact I actually load only
>>> one lib:
>>>
>>> static {
>>> System.loadLibrary("scijni");
>>> }
>>>
>>> while the other (scilexer.dll) is loaded directly by this lib.
>>>
>>> The error I got was due to the fact scijni.dll can't find scilexer.dll.
>>> In order to have it working I need to have scilexer.dll in the PATH.
>>> So there are two different mechanisms for loading the two libs.
>>> That's why I took so long to find out wat was wrong.
>>>
>>> A friend of mine said bugs always come in couples... and if you don't
>>> squash them fast enough they spawn!
>>>
>>> Is there a way I can modify (progrmmatically or via some XML) the PATH
>>> environment variable for scijni?
>>>
>>>>
>>>> Tom
>>>>
>>>> Am 14.08.10 00:32, schrieb Mauro Condarelli:
>>>>> Hi,
>>>>> this should be trivial, but I'm getting mad :(
>>>>>
>>>>> I am tring to use Jintilla, which has a couple of dll containing the
>>>>> editor compnent itself.
>>>>>
>>>>> I have not found the right incantation to convince my stupid
>>>>> wrapper to
>>>>> fint them in a dir in my workspace.
>>>>>
>>>>> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
>>>>> directory.
>>>>> If I place the two diretories there everything is ok.
>>>>>
>>>>> If I place them anywhere else, even if I modify "java.library.path"
>>>>> and/or "sun.boot.library.path", explicitly or via IDE settings the
>>>>> closest I get is:
>>>>>
>>>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
>>>>> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
>>>>> Routine di inizializzazione della libreria di collegamento dinamico
>>>>> (DLL) non riuscita
>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
>>>>> at it.condarelli.jintilla.Main.main(Main.java:46)
>>>>>
>>>>> which seems to indicate the dll is actually found, but something else
>>>>> coes wrong (perhaps the second one is not found?)
>>>>>
>>>>> Can someone help me, please?
>>>>>
>>>>> Thanks in Advance
>>>>> Mauro
>>>>
>>>
>>
>
Re: classpath problem [message #553212 is a reply to message #553107] Mon, 16 August 2010 16:42 Go to previous message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Il 16/08/2010 15:21, Jim Cooper ha scritto:
> On Windoze, the current directory is always in the path. Most DLLs also
> see the directory they were loaded from.
>
> If you physically include both DLLs in your project in the same
> directory (especially in the same directory as the main 'executable',
> your problem may be resolved.
>
> Another alternative is to do the LoadLibrary on the scilexer.dll before
> the scjni.dll, just so it it will already be in memory (where it should
> be found before the path is searched).
Thanks,
it should work.

I already solved the problem modifying the first library so I add the
directory where it is to the front of the search path.
This way everything is ok if thetwo .DLL are in the same place.

Thanks.
Mauro

>
> On 8/14/2010 9:39 AM, Mauro Condarelli wrote:
>> I don't think so, Tom.
>>
>> The second dll (scilexer.dll) is not a jni lib, it's a regular C++ dll,
>> while the first (scjni.dll) is a jni wrapper around it.
>>
>> I can try to load it, but I do not realy expect it to work.
>>
>> I would like to further wrap this into a SWT Composite, adding several
>> controls.
>>
>> scilexer. dll is the Scintilla editor component and I would like to have
>> it, together with menu and toolbars in a shrink-wrapped SWT component (I
>> didn't find anything equivalent so far: StyledText falls very short on
>> two issues: wordwrap and spellcheck, unfortunately).
>>
>> That is the reason why I would like to find a way to add to PATH
>> programmatically and I would like to avoid resorting to command-line
>> options or similar.
>>
>> Any suggestion?
>>
>> Regards
>> Mauro
>>
>>
>> Il 14/08/2010 15:13, Tom Schindl ha scritto:
>>> Can't you simply include the 2nd one as well in your project?
>>>
>>> Tom
>>>
>>> Am 14.08.10 10:48, schrieb Mauro Condarelli:
>>>> Il 14/08/2010 08:28, Tom Schindl ha scritto:
>>>>> You need to use the "Bundle-NativeCode" header in your MANIFEST.MF and
>>>>> you need to load them in the correct order. If DLL2 depends on DLL1
>>>>> you
>>>>> need to:
>>>>>
>>>>> System.loadLibrary("DLL1");
>>>>> System.loadLibrary("DLL2");
>>>>>
>>>>> If you use Bundle-NativeCode you don't need to modify the
>>>>> java.library.path.
>>>>
>>>> Thanks, will do.
>>>> A bit of additional complexity comes from the fact I actually load only
>>>> one lib:
>>>>
>>>> static {
>>>> System.loadLibrary("scijni");
>>>> }
>>>>
>>>> while the other (scilexer.dll) is loaded directly by this lib.
>>>>
>>>> The error I got was due to the fact scijni.dll can't find scilexer.dll.
>>>> In order to have it working I need to have scilexer.dll in the PATH.
>>>> So there are two different mechanisms for loading the two libs.
>>>> That's why I took so long to find out wat was wrong.
>>>>
>>>> A friend of mine said bugs always come in couples... and if you don't
>>>> squash them fast enough they spawn!
>>>>
>>>> Is there a way I can modify (progrmmatically or via some XML) the PATH
>>>> environment variable for scijni?
>>>>
>>>>>
>>>>> Tom
>>>>>
>>>>> Am 14.08.10 00:32, schrieb Mauro Condarelli:
>>>>>> Hi,
>>>>>> this should be trivial, but I'm getting mad :(
>>>>>>
>>>>>> I am tring to use Jintilla, which has a couple of dll containing the
>>>>>> editor compnent itself.
>>>>>>
>>>>>> I have not found the right incantation to convince my stupid
>>>>>> wrapper to
>>>>>> fint them in a dir in my workspace.
>>>>>>
>>>>>> I can make it work *ONLY* if I place them in the systrm Java\jre6\bin
>>>>>> directory.
>>>>>> If I place the two diretories there everything is ok.
>>>>>>
>>>>>> If I place them anywhere else, even if I modify "java.library.path"
>>>>>> and/or "sun.boot.library.path", explicitly or via IDE settings the
>>>>>> closest I get is:
>>>>>>
>>>>>> Exception in thread "main" java.lang.UnsatisfiedLinkError:
>>>>>> C:\Users\Mauro\workspace\it.condarelli.jintilla\resources\sc ijni.dll:
>>>>>> Routine di inizializzazione della libreria di collegamento dinamico
>>>>>> (DLL) non riuscita
>>>>>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>>>>>> 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 org.scintilla.editor.Scintilla.<clinit>(Scintilla.java:52)
>>>>>> at it.condarelli.jintilla.Main.main(Main.java:46)
>>>>>>
>>>>>> which seems to indicate the dll is actually found, but something else
>>>>>> coes wrong (perhaps the second one is not found?)
>>>>>>
>>>>>> Can someone help me, please?
>>>>>>
>>>>>> Thanks in Advance
>>>>>> Mauro
>>>>>
>>>>
>>>
>>
>
Previous Topic:Re: Key bindings not working in Eclipse
Next Topic:Hide/Show Status Bar any time
Goto Forum:
  


Current Time: Tue Sep 24 15:43:48 GMT 2024

Powered by FUDForum. Page generated in 0.04495 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top