The project I'm working on is a server-side Clojure project with Leiningen as my build tool.
The problem occurs when I try to run the JAR I created using Leiningen's uberjar.
The JAR is dependent on some native libraries I've placed in: /usr/lib/nativedeps/so.
Before I run the JAR I export the environment variable LD_LIBRARY_PATH with the native libs path so the linker will know where to look for the native libs:
export LD_LIBRARY_PATH=/usr/lib/ctch/so
And then I run it the JAR:
java -jar externalapibe-0.1.0-standalone.jar 3001
Which throws the exception:
java.lang.UnsatisfiedLinkError: no JavaASAPSDK in java.library.path
Which means the linker is unable to find JavaASAPSDK (which is one of the native libs in /usr/lib/nativedeps/so) and that I need to specify the lib path in java.library.path. So I run:
java -Djava.library.path=/usr/lib/nativedeps/so -jar externalapibe-0.1.0-standalone.jar 3001
Which throws the exception:
java.lang.UnsatisfiedLinkError:
/usr/lib/nativedeps/so/libJavaASAPSDK.so: libprotobuf.so.6: cannot
open shared object file: No such file or directory
Which means the lib JavaASAPSDK was found, but another lib called libprotobuf.so.6 (which JavaASAPSDK is dependent on) could not be found.
Problem is both libs are in the same directory!
Any ideas on what can cause this problem and how to solve it???
I solved the problem by deleting:
libprotobuf.so.6
And creating a symbolic link named 'libprotobuf.so.6' to a library that apparantly was identical to libprotobuf.so.6, named libprotobuf.so.6.0.0.
Then I created a configuration file in: /etc/ld.so.conf.d/
touch /etc/ld.so.conf.d/externalapibe.conf
And wrote the path of my native libs in it:
/usr/lib/nativedeps/so
Then I ran:
ldconfig -v | grep /usr/lib/nativedeps/so
Which read the path of my native deps from 'externalapibe.conf' and re-binded the native libs in it.
That seemed to do the work.
Related
I am always using QDesignerCustomWidgetInteface. I want to use two kinds of CustomWidget in another CustomWidget to combine two of them so that I need not to write some codes again.
So I write codes as below in project file:
LIBS +=-L./debug -lxzquxianplugin
LIBS +=-L./debug -lxzyctextplugin
When I finished the code I debug the codes in creator and started debugging designer. Designer ran well and recognized my new CustomWidget. But when I entered bin/gcc/debug folder and ran executable app Designer that debug mode produced directly without codes and Qt creator, Designer showed that could not find shared library: libxzquxianplugin.so.
I tried to use codes as below:
Debug {
LIBS +=absolute path way of xzquxianplugin
LIBS +=absolute path way of xzyctextplugin
}
But it still failed to find dynamic library when I ran Designer in debug folders. I cannot understand why it happened.
the libs -L switch is used when you want to add a directory to linker search path, you used:
LIBS +=-L. /debug -lxzquxianplugin
Which actually breaks your path because of the space after -L.
So you should have
LIBS +=-L./debug -lxzquxianplugin
given that your lib exists under debug folder.
I have installed scala-async.jar for Eclipse (it is easy to edit the .classpath file) but I also want to compile/run it with command line scala. Scalac says object async is not a member of package scala. Where do I place the jar?
Placing maven released-jar into C:\Program Files (x86)\scala\lib did the trick. I have figured out the folder location with Process Monitor.
tomcat
-webapps
-Servlet
-WEB-INF
-lib
-classes
-cc
-openhome
-HelloServlet.java
in cmd ,
C:\tomcat\webapps\Servlet>javac -classpath .;c:\tomcat\lib\servlet-api.jar -d ..\classes\cc\openhome\HelloServlet.java
but message says directory not found
and I compile the HelloServlet.java , it shows package javax.servlet does not exist
I tried each method found from here, is anyone know what it happens? thank you
-d is the switch for changing output directory and not for defining a java source file and it expects a directory, not a file.
Also that class folder is usually for the compiled classes and not for the sources.
Try this:
javac -classpath .;c:\tomcat\lib\servlet-api.jar -d .\WEB-INF\classes .\WEB-INF\classes\cc\openhome\HelloServlet.java
I created simple Java Servlet: WelcomeServlet.java.
Than, I tried compile this file via:
javac WelcomeServlet.java
In result I see compile error:
package javax.servlet doesn't exit
I try find solution for this error with Google. And I find first part of answer: java compiler doesnt see servlet-api.jar file.
I know, that Apache Tomcat in it lib folder contains servlet-api.jar file.
So, I have this file, but where I must copy this file??
I try different folders:
echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_26
%PATH% contains this line: C:\Program Files\Java\jdk1.6.0_26\bin
So, I copy in:
%JAVA_HOME%\bin
%JAVA_HOME%\lib
%JAVA_HOME%\jre\lib
And in result same error.
And only after I copy servlet-api.jar in directory:
%JAVA_HOME%\jre\lib\ext
compilation complite sucessful.
My question: Why? Why I must copy in folder %JAVA_HOME%\jre\lib\ext ??
Where This moment describe in documentation?
And other question we have some official docs or specifications that describe folder structure for jdk folder??
You'll need to specify the directory or directories you want the compiler to search by using the -classpath command line option when running javac. The reason the compiler found your .jar in %JAVA_HOME%\jre\lib\ext is because it searches the extension directories by default.
This is for Java 1.5, but I believe it is more or less still correct:
http://docs.oracle.com/javase/1.5.0/docs/tooldocs/findingclasses.html
The link Shaun provides is a more complete answer. But in short, using the classpath is the best way to introduce 3rd party or external (to the JDK/JRE) libraries. The classpath is a concept much like the %PATH% or the $PATH variables, but specifies locations for java to use for lookup rather than the shell to use for lookup of executables.
The classpath provides the java compiler or java virtual machine a list of items to use when searching for resources. This "path" may include directories or files. It will typically include jar files and sometimes locations of configuration files. Many Java based lookup schemes for files configuration or otherwise use some variant of what is accomplished by [Class#getResourceAsStream()][1]'s use of walking the Classpath.
I have rarely seen an incident where putting a jar file in the lib/ext location was preferred to utilizing the Classpath.
The classpath is typically an environment variable (%CLASSPATH% or $CLASSPATH) or specified on the command line when running java or javac (e.g. -cp or -classpath see the help from the executable you are running).
Build tools such as Ant and Maven will also provide abstractions to defining the list of jars to be utilized by your applications and are highly recommended to be used for any length of repetitive change code, build, test, run cycles.
Here is my problem:
I'm building an AIR package, using the mxmlc and adt command line tools.
I run the following command in a /bin/stagging directory
mxmlc +configname=air -compiler.library-path+=..\..\my_project\libs\,
..\..\Modeles\libs,..\..\Service\libs,..\..\sflexlib\libs
-define+=CONFIG::appMode,"'staging'" ..\..\my_project\src\my_project.mxml
-o my_project.swf
So I create a file called my_project.swf including all the libs I need and the mxml application is the my_project.mxml file.
A my_project.swf file is created but I cannot test it at that moment because it is an AIR application. So I launch this command:
adt -package -storetype pkcs12 -keystore "..\..\certificat.p12"
-storepass "mypass" my_project.air my_project-app.xml my_project.swf
-C ..\..\my_project\src\assets\ .
If I understood the adt command, this should create an .air package described by the my_project-app.xml file and including the my_project.swf file and assets directory. I install the app and launch it but no pictures are displayed... I look in the installation folder and there is an assets folder containing all the pictures :(
If I launch the app directly via the FlashBuilder IDE, the pictures are well displayed.
Has anybody a solution to that? As said, the pictures are correctly extracted from the package and installed but not displayed... The paths are correct too =(
Thank you in advance
I found the solution! The halo theme was not included in the compilation line!
So I added it and launched that command:
mxmlc +configname=air -compiler.library-path+=..\..\my_project\libs\,
..\..\Modeles\libs,..\..\Service\libs,..\..\sflexlib\libs
-define+=CONFIG::appMode,"'staging'" -theme+="%FLEX45_FRAMEWORK%"\themes\Halo\halo.swc
..\..\my_project\src\my_project.mxml -o my_project.swf
%FLEX45_FRAMEWORK% is the FLEX_4.5_PATH\frameworks directory
I found the solution when I got an error by changing Embed to url() in the css file. Before that it was only a warning! =)
Thank you guys!