I'm trying to use ZeroMQ on CentOS.
I followed the install instructions for unix like platforms
I keep getting the following exception when running:
java.lang.UnsatisfiedLinkError: no jzmq in java.library.path
However the following line fixes this problem:
export LD_LIBRARY_PATH=/usr/local/lib
What exactly is this LD_LIBRARY_PATH and why is not explained in the install instructions? Do I need to run this export everytime?
It's a way to specify where to load some native library (.so file) the app is using. You can get that variable defined in the environment in a number of ways, depending on what you need. If you are going to have the MQ start when the os boots, you could put the export in the startup shell script. Or it might go in /etc/bashrc, or it might go in ~/.bashrc It just depends on what you need.
FYI I don't know anything about ZeroMQ itself.
Related
I would like to load the local library /opt/gurobi902/linux64/lib/libGurobiJni90.so within my Java IntelliJ Maven project on Ubuntu 19.10.
My first attempt was adding the environment variable LD_LIBRARY_PATH like this: export LD_LIBRARY_PATH="/opt/gurobi902/linux64/lib" (I know I have completly overwritten it instead of appending to it, because it was not set at all previously.)
I thought it worked, because when I run the terminal command java -XshowSettings:propertiesjava -XshowSettings:properties it returns this (among other things):
java.library.path = /opt/gurobi902/linux64/lib
/usr/java/packages/lib
/usr/lib/x86_64-linux-gnu/jni
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/jni
/lib
/usr/lib
BUT when I want to load the library in my project with System.loadLibrary("GurobiJni90") I receive this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no GurobiJni90 in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
As you can see, the directory I've added previously is not listed in java.library.path of the exception statement.
Btw. this is my pom.xml entry for the library:
<dependency>
<groupId>com.gurobi</groupId>
<artifactId>gurobi</artifactId>
<version>9.0.2</version>
<scope>system</scope>
<systemPath>/opt/gurobi902/linux64/lib/gurobi.jar</systemPath>
</dependency>
The environment variable LD_LIBRARY_PATH needs to point to a directory (or a list thereof), not to a specific library.
This is also outlined in the Gurobi installation guide.
The issue is fixed now!
It seems like my linux distribution (Ubuntu 19.10) doesn't allow applications to read the .bashrc file where the environment variables are set. This explains why java.library.path hold different contents when accessed from the terminal or my own IntelliJ project.
The Gurobi Installation Guide mentions this issue (but I thought I wasn't affected):
In some Linux distributions, applications launched from the Linux desktop won't read .bashrc (or .cshrc). You may need to set the Gurobi environment variables in .bash_profile or .profile instead. Unfortunately, the details of where to set these variables vary widely among different Linux distributions. We suggest that you consult the documentation for your distribution if you run into trouble.
I've added the environment variables manually to my project in IntelliJ via the menu [Run] > [Edit Configurations] > [Environment variables] since I need them only in this project. Works for me!
I downloaded the Carrot2 Document clustering server build 3.15.0 for Mac. The read me file says:
The DCS requires a Java Runtime Environment (JRE) version 1.7.0 or later. To
run the DCS, execute the 'dcs' script and point your browser at
http://localhost:8080 for further instructions.
Mac OS Sierra doesn't make it easy, but I got 1.8.0_112 installed.
The problem is that I don't know how to execute the 'dcs' script.
There are .cmd, .sh, .war, and .jar files. I wasn't sure which of those to work with. I thought .jar looked promising, so I followed some of this thread and tried this in a terminal window:
java -jar invoker.jar
I cd-ed to the correct directory, but it just says Provide main class, but I'm not sure what or where that is.
Can anybody provide instructions or a link to how to do this?
Use the dcs.sh (on Linux/Mac) and dcs.cmd (on Windows) to start the server. The scripts will set some extra options for the JVM and then start the DCS. In case of any problems, append the -v option to see diagnostic output.
I am trying to install JNetPcap and followed the instructions given at here. At step 12, I am unable to run the ant command and i see the error
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/java-6-sun/bin/java
As I am able to run Java classes from eclipse or from command line I don't think if it's a problem with JAVA_HOME.
echo $PATH shows
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin
Kindly let me know if am missing something here.
thanks in advance
Neither running java from the command line or running eclipse will require JAVA_HOME to be set. However, the build procedure you are trying to use ant, and ant often does require JAVA_HOME to be set appropriately. (It actually depends on the version of ant that you are using. The use of JAVA_HOME is typically in the wrapper script for ant.)
Just set it.
JAVA_HOME should probably be set to /usr/lib/jvm/java-6-sun ... based on what you gave said PATH to.
However, it is also possible that the problem is that your PATH is incorrect. Or that you have (somehow) managed to get the owner/group/permissions on your Java install incorrect, such that the java command isn't executable.
Check that running java -version displays the installed Java version.
Repeat with /usr/lib/jvm/java-6-sun/bin/java -version.
I am getting the following error when I try to run jgr-x64.exe on Windows 7 64-bit.
Couldn't install JGR!
Please re-install R and/or connect to the internet
My Packages are getting installed at
\AppData\Local\Temp\Rtmp886Wzb\downloaded_packages
Is it something to do with setting environmental variables?
Any advise on how to solve this?
For non-standard R library locations, you need to tell jgr-x64.exe where to look for the JGR package. Some instructions on how to do this are at: http://www.deducer.org/pmwiki/pmwiki.php?n=Main.RunningJGRWithANon-standardRInstallation
The newest development version of JGR can automatically create a script to do this for you. You can test it out by doing the following:
install.packages("JGR",,"http://www.rforge.net",type="source")
library(JGR)
JGR()
At the R prompt, you must be in a directory where you have write access (run as admin if necessary, or else setwd() to your preferred directory) when you run JGR() for the first time. This will download jgr-1_62-x64.exe and create a jgrLaunch.bat file tailored to your system. It defines environment variables and command-line options to jgr-1_62-x64.exe.
You can move these files (e.g. to the desktop) after creation; just note that jgrLaunch.bat calls jgr-1_62-x64.exe, so the latter must either be in PATH or in the same directory as the .bat file.
I'm trying to get my Apache Lucene demo to work and I'm down to setting the classpath in this tutorial http://lucene.apache.org/java/2_3_2/demo.html
I've hunted the web and these wer the 2 solutions I found to set CLASSPATH:
CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar
and
setenv CLASSPATH ${CLASSPATH}:/Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar
The second one brings up a error
-bash: setenv: command not found
The first one seemed to accept ok but wen i tried the next step in the tutorial i got an error. The next step was to run the following:
Phil-hunters-MacBook:webapps philhunter$ java org.apache.lucene.demo.IndexFiles /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/src
which gave me the error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/demo/IndexFiles
This leads me to believe my CLASSPATHS didnt set correctly. Would I be right in assuming this? I have tried other tutorials and demos and see to get this same error quite a bit. Im new to Lucene and relatively new to mac and Unix shell scripting. Anyone know if I am setting the CLASSPATH correctly and if thats the cause of the errors?
in the terminal type
$ vim ~/.bash_profile
edit the file and add one line:
export CLASSPATH=${CLASSPATH}:/usr/local/lucene-3.6.2/lucene-core-3.6.2.jar:/usr/local/lucene-3.6.2/contrib/demo/lucene-demo-3.6.2.jar;
make sure to change the path of yours.
In your way you lose to add lucene-demo-3.0.3.jar in your classpath.
When you set an environment variable like CLASSPATH then by default it only applies to the current process (i.e. the shell process itself) - it isn't available to the java process you launch in the next line. In order to make it available to other processes you need to "export" the variable. In this case you can use something like:
export CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar
This basically says "set the CLASSPATH variable to its current value plus the location of the lucene jar, and make the new variable available to any processes launched from this shell".
However, with java the usual way of setting the classpath is to do it as part of the java command itself, using the -classpath or -cp options. In your case it would look something like:
Phil-hunters-MacBook:webapps philhunter$ java -cp /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/lucene-core-3.0.3.jar org.apache.lucene.demo.IndexFiles /Users/philhunter/Desktop/COM562\ Project/lucene-3.0.3/src
As an aside, the error you see when using the setenv line is because setenv is the command used in the C shell to set environment variables, but the default Mac shell (and the shell you're using) is bash which doesn't recognise setenv and lets you know it doesn't recognise it with the error message: -bash: setenv: command not found.
i create a .bash_profile file in my home directory and do things like
export GRAILS_HOME=/usr/share/grails
...
export PATH=${GRAILS_HOME}/bin:${GROOVY_HOME}/bin:/usr/local/mysql-5.1.45-osx10.6-x86_64/bin:${PATH}
you can work of that to set the classpath -- these examples show how to declare an environment variable and how to use the variable in other variables.