There is no direct answer. But here are some suggestions.

If you add the .so file in the src/main/resources directory of your project it 
should get included in the app jar (please check, otherwise you'll need to 
tweak the gradle script or post-process the s4r file).

Then when loading the .so file, you might want to use something along these 
lines  : use System.loadLibrary() , pass it the library path , that you get 
through something like: getClassLoader().getResource(.so lib name) + get a path 
for that resource.

Note: the classloader must be this of the S4 application (that can load the 
contents of the S4R file)


Hope this helps,

Matthieu 


On May 9, 2013, at 15:19 , ?????? wrote:

> 
> Yes,I checked the s4r file,there is jnetpcap.jar.
> I edited the native libraries of jnetpcap.jar in eclipse.However,there are no 
> native libraries in the s4r file.
> I don't know how to add the native libraries to s4r file.
> 
> ------------------ ???????? ------------------
> ??????: "Matthieu Morel"<matth...@yahoo-inc.com>;
> ????????: 2013??5??9??(??????) ????6:53
> ??????: "<s4-user@incubator.apache.org>"<s4-user@incubator.apache.org>;
> ????: Re: ?????? dependency
> 
> 
> On May 9, 2013, at 05:26 , ?????? wrote:
> 
>> 
>> Hi,I have read the dependency document  
>> http://incubator.apache.org/s4/doc/0.6.0/application_dependencies/;
>> I want to use jnetpcap in my project.
>> I edited the build.gradle by adding compile ':jnetpcap' to 
>> dependencies
>>  {}.
>> 
>> And while I run the command "
>> ./s4
>>  s4r -a=hello.HelloApp -b=`pwd`/build.gradle myApp",it showed "build 
>> successful".
>> 
>> However,while the project was running,it came below errors:
>> 
>> 
>> 10:39:18.003 [itoa] ERROR org.apache.s4.core.S4Node - Uncaught exception in 
>> thread itoa
>> java.lang.NoClassDefFoundError: Could not initialize class 
>> org.jnetpcap.packet.PcapPacket
>>     at hello.AbstractPE.onEvent(AbstractPE.java:28) 
>> ~[phishApp.jar:unspecified]
>>     at OverloadDispatcher192.dispatchEvent(Unknown Source) ~[na:na]
>>     at 
>> org.apache.s4.core.ProcessingElement.handleInputEvent(ProcessingElement.java:461)
>>  ~[s4-core-0.6.0-incubating.jar:0.6.0-incubating]
>>     at 
>> org.apache.s4.core.Stream$StreamEventProcessingTask.run(Stream.java:333) 
>> ~[s4-core-0.6.0-incubating.jar:0.6.0-incubating]
>>     at 
>> org.apache.s4.comm.staging.BlockingThreadPoolExecutorService$RunnableWithPermitRelease.run(BlockingThreadPoolExecutorService.java:178)
>>  ~[s4-comm-0.6.0-incubating.jar:0.6.0-incubating]
>>     at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>  ~[na:1.7.0_19]
>>     at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>  ~[na:1.7.0_19]
>>     at java.lang.Thread.run(Thread.java:722) ~[na:1.7.0_19]
>> 
>> 
>> I don't know what caused the error.I check the *.jar file compiled by the 
>> s4r command.In the *.jar file ,there is class org.jnetpcap.packet.PcapPacket 
>> in jnetpcap.jar file.
> 
> 
> If your dependency is not in the standard maven repository, make sure it is 
> in the lib directory.
> 
> The jnetpcap.jar file must be embedded in the generated s4r file, can you 
> make sure this is the case (just unzip to check)?
> 
> 
> Matthieu
> 
>> 
>> ------------------ ???????? ------------------
>> ??????: "Matthieu Morel"<mmo...@apache.org>;
>> ????????: 2013??5??8??(??????) ????9:42
>> ??????: "s4-user"<s4-user@incubator.apache.org>;
>> ????: Re: dependency
>> 
>> Please check the 0.6.0 documentation here: 
>> http://incubator.apache.org/s4/doc/0.6.0/application_dependencies/
>> 
>> Hope this helps,
>> 
>> Matthieu
>> 
>> On May 8, 2013, at 15:39 , ?????? wrote:
>> 
>>> How to add dependencies to my S4 application?
>>> I want to use jnetpcap in one PE.
>>> How to add dependencies to my s4 application?
>> 
> 

Reply via email to