|shared native library [message #638837]
||Fri, 12 November 2010 12:43
| Stefan Harjes
Registered: November 2010
I am writing a java servlet which I deploy using tomcat-6. It uses native C++ code for USB access.
Depoying by hand works fine. The wrapper .jar goes to CATALINA_BASE/lib and the library libnative.so is placed in CATALINA_BASE/shared/lib. I can deploy the eclipse war file, but when I start the eclipse tomcat instance, I get an error that the native library is not in the java.library.path.
In the tomcat-6 system instance I add -Djava.library.path in the config files. Is there any way to do this in eclipse??
p.s. I tried the native library entry in the Deployment Assembly properties without success
|Re: shared native library [message #638882 is a reply to message #638847]
||Fri, 12 November 2010 16:19
| Russell Bateman
Registered: July 2009
Location: Provo, Utah, USA
On 2010.11.12 11:30, Stefan Harjes wrote:|
> Hi Russel,
> thanks for the quick response, I tried the tip, but got the
> same error. I also tried to add the native library to other jars without
> Do you by any chance know if the eclipse tomcat makes a copy of the
> tomcat system libraries (if so where)?
I may not be the best resource on this. What version of Eclipse are you
In Eclipse, you're going to use Build Path to make known the libraries
you're using. In my example, which didn't use Tomcat so there may be a
difference, I made the path to the JNI (shared object) known to the one
JAR that consumed it. Eclipse did the rest such that, when flexlm.jar
code went to open it, it was there.
Eclipse sort of makes copies of the Tomcat libraries. The way Eclipse
deploys the application inside Eclipse (for debugging, running, etc.) is
to copy everything as if really deploying it to the path:
<workspace> /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpweba pps/...
where "..." is what you'd expect to find under Tomcat's webapps
directory. So, for the JARs, this would be
<application-name>/WEB-INF/lib. What you'll find there is all the
libraries you signed up for in Build Path including the Tomcat ones:
....and all of the others (in this case, Hibernate, MyFaces JSTL, Log4j,
etc.) that aren't shown in this illustration.
Last, this is influenced by marking a lot of the JARs in Build Path as
"Java EE Module Dependencies" as shown here. However, this stopped being
done this way in Galileo. It's done differently in Helios and I don't
know if that's relevant here.
I'm not sure I'm helping you, but perhaps knowing this and comparing it
to what you see will jar something in your mind (no pun intended).
|Re: shared native library [message #639178 is a reply to message #638837]
||Mon, 15 November 2010 09:34
| Larry Isaacs
Registered: July 2009
On 11/12/2010 12:43 PM, Stefan Harjes wrote:|
> I am writing a java servlet which I deploy using tomcat-6. It uses
> native C++ code for USB access.
> Depoying by hand works fine. The wrapper .jar goes to CATALINA_BASE/lib
> and the library libnative.so is placed in CATALINA_BASE/shared/lib. I
> can deploy the eclipse war file, but when I start the eclipse tomcat
> instance, I get an error that the native library is not in the
> In the tomcat-6 system instance I add -Djava.library.path in the config
> files. Is there any way to do this in eclipse??
> p.s. I tried the native library entry in the Deployment Assembly
> properties without success
Open the Tomcat server's launch configuration per:
http://wiki.eclipse.org/WTP_Tomcat_FAQ#How_can_I_view_or_mod ify_the_launch_configuration_properties_for_a_Tomcat_server. 3F
You can set what you need there. You can set a java.library.path
directly in the VM Arguments on the Arguments tab. Also, I typically
override the PATH environment variable on Environment tab and allow Java
to build a default java.library.path, which includes the PATH entries.
For details about the WTP Tomcat support, see the other info in the
Tomcat FAQ, especially:
http://wiki.eclipse.org/WTP_Tomcat_FAQ#When_I_create_a_new_T omcat_server.2C_what_should_I_know_about_its_default_configu ration.3F
Powered by FUDForum
. Page generated in 0.02212 seconds