I am trying to build Casandra project on a Centos server. I downloaded the file from here.
http://apache.bilkent.edu.tr/cassandra/2.0.6/
Here is the README.txt file
This short guide will walk you through getting a basic one node cluster up
and running, and demonstrate some simple reads and writes.
* tar -zxvf apache-cassandra-$VERSION.tar.gz
* cd apache-cassandra-$VERSION
* sudo mkdir -p /var/log/cassandra
* sudo chown -R `whoami` /var/log/cassandra
* sudo mkdir -p /var/lib/cassandra
* sudo chown -R `whoami` /var/lib/cassandra
Note: The sample configuration files in conf/ determine the file-system
locations Cassandra uses for logging and data storage. You are free to
change these to suit your own environment and adjust the path names
used here accordingly.
Now that we're ready, let's start it up!
* bin/cassandra -f
As README.txt file suggested I followed these instructions as adapting to my case (I am not root).
tar -zxvf apache-cassandra-2.0.6-src.tar.gz
cd apache-cassandra-2.0.6-src
mkdir -p var/log/cassandra
chown -R `whoami` var/log/cassandra
mkdir -p var/lib/cassandra
chown -R `whoami` var/lib/cassandra
Since I am not root on the server, I can not create my files under /var folder. So, I created new folder var under apache-cassandra-2.0.6-src and put my lib and log files there. Then I followed next instructions from README.txt file.
bin/cassandra -f
However whatever I tried it is no good, I always get this error.
Error: Could not find or load main class org.apache.cassandra.service.CassandraDaemon
How can I fix this problem?
My java version
java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (rhel-2.4.4.1.el6_5-x86_64 u51-b02)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
EDIT:
As an extra informaiton, I tried this instructions on my pc, too. Exactly same thing with README.txt file using sudo and it worked.
I see you have downloaded the source package (apache-cassandra-2.0.6-src.tar.gz), but the instructions you posted seem to assume it is already built.
You need to build the source package before you can use it; there would be a separate set of instructions for that somewhere.
I suspect you'd rather just run it instead of building it from source. You may have meant to download the binary package apache-cassandra-2.0.6-bin.tar.gz instead (note "bin", not "src" -- this is a traditional naming convention when separating binaries from source in downloadable archives). With that package you can just run it right out of the box. For the source package you'd need to follow the build instructions to compile cassandra first.
I also suspect that you downloaded the binary package on the PC side, which is why it worked there.
If you do need to build from source:
Install ant and ant-optional if you do not already have it.
Extract the source archive somewhere, then in the base directory (where build.xml is):
ant release
Make a cup of coffee (the rat task at the end takes forever).
Binary archives will be created in build, and a built distribution can be found in build/dist.
do a export CASSANDRA_HOME=location of cassandra
should work in 2.0.6 i verified just then without setting that variable and after setting those variables.
$ export CASSANDRA_HOME=/usr/local/cassandra/dsc-cassandra-2.0.6
$ /usr/local/cassandra/dsc-cassandra-2.0.6/bin/cassandra
or
$ cd /usr/local/cassandra/dsc-cassandra-2.0.6
$ export CASSANDRA_HOME=
$ bin/cassandra
in fact you can also set CASSANDRA_HOME= in cassandra-2.0.6 directory. set it to empty value if you are executing the export command from the cassandra directory.
Path for CASSANDRA_HOME was incorrect for me. After i set the correct path it ran perfectly.
In the cassandra.yaml configuration file, change the
commitlog_directory
data_file_directories
saved_caches_directory
properties to the path you have specified as they are no longer /var/lib...
You will need to set them to point to wherever the directories actually are.
I faced exact problem, where I wanted to install cassandra in userspace without any sudo privileges. I did the following
In cassandra.yaml I changed the following config to local path
commitlog_directory
data_file_directories
saved_caches_directory
log4j.appender.R.File
Installed the "bin" tar files for the particular OS env and not the "src" file.
Export CASSANDRA_HOME=/userspace/cassandra-2.x
Now it works fine for me.
I faced same issue when I used Jdk 1.8_281 version.
The problem was resolved when I downgraded to jdk 1.8_241 version.
Related
I have code of a research project managed by datalad (which is a frontend for git and git-annex). It contains my code together with a Singularity container for reproducibility.
I installed java manually into this directory. I could run java -version initially but once I have committed my changes using git annex add <java_dir>, git add . and git commit, I cannot start java anymore. I get the following error message:
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.
How can I avoid this incompatibility between java and git-annex?
(Annex: how I installed java)
mkdir lib
cd lib
wget https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246799_424b9da4b48848379167015dcc250d8d -O jre_8_341.tgz
tar -xf ./jre_8_341.tgz # creates jre1.8.0_341/
rm jre_8_341.tgz
cd jre1.8.0_341/bin
Turns out that the java binary tries to find its own path, as can be seen by calling strace java -version:
< ... lots of strace output... >
readlink("/proc/self/exe", "/proj/.git/annex/objects/X5/f3/M"..., 4096) = 120
< ... more strace output ...>
The readlink syscall leads into the .git/annex/objects directory where git-annex saves big files. Thus, java gets the wrong answer what is its installation directory and thus fails.
The solution is to git annex unlock $JAVA_HOME/bin/java (where $JAVA_HOME is the folder you extracted java to). The same must be done with $JAVA_HOME/lib/amd64/server/libjvm.so which tries the same manoever.
Finally, the files must be committed in unlocked state. In effect, the files
must not be symlinks into the git-annex object storage but regular files.
I am working in Ubuntu 16.04. I need to install gradle and the gradle is installed when i checked with sudo apt list --installed command but when i use gradle -version command it shows the following error,
JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oracle/jre/bin/java
In sudo vim /etc/environment file,
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
http_proxy="http://username:password#IP:port no/"
https_proxy="https://IP:port no/"
ftp_proxy="ftp://IP:port no/"
I don't know where i made mistakes. Please help me.
Thanks.
On a 64bit openSuse 64 42.1 box;
readlink -f $(which java)
provided;
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java
But;
export JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
is the path that worked and allowed java emulator to run.
So i think we have to manually browse our file system and see what path to choose.
Today I faced this problem. I am using the default java that comes with your linux distro (so in my case, linux mint).
$ whereis java
This command gave me
java: /usr/bin/java /usr/share/java
So, I opened /user/bin. There was a link to Java. I right clicked it and selected follow original link. This lead me to /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
So now that I know where this java is, I opened my .bashrc file, and edited the JAVA_HOME.
So for my case,
## My Custom variables
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
This solved the problem.
Now if you are using some other java (say you downloaded from oracle and extracted the zip file ...), then you have to add that location. So for example, if your java is in /home/user/.sdkman/candidates/java/current, then
export JAVA_HOME=/home/user/.sdkman/candidates/java/current
export PATH=$JAVA_HOME/bin:$PATH
I see a mismatch. In your enviornment file the JAVA_HOME is set to "/usr/lib/jvm/java-8-openjdk-amd64/" and your mentioned that the error that you got relates to the JAVA_HOME as "/usr/lib/jvm/java-8-oracle/jre/bin/java"
If you JAVA is really installed in /usr/lib/jvm/java-8-oracle directory, then you need to ensure that the JAVA_HOME is set to that directory. And also your PATH reflects $JAVA_HOME/bin in it.
I typically install Oracle JDK/JRE separately in a separate directory such as /usr/local/jdk1.8.0 etc.
check the jvm installtion folder from Files
eg : /usr/lib/jvm/java-12-oracle
then in terminal run sudo nano /etc/environment and add the line
JAVA_HOME="/usr/lib/jvm/java-12-oracle"
Then open terminal and run
export JAVA_HOME="/usr/lib/jvm/java-12-oracle"
I'm running Elementary OS (Ubuntu 12 based), and I'm having issues running apache ant. It was working earlier before a restart, so I'm not sure what would've changed.
I've defined environment variables in /etc/environment as follows:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$ANT_HOME/bin"
JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-i386"
ANT_HOME="/opt/ant"
ANT_OPTS="-Xms256M -Xmx512M"
So my Java and Ant environment variables should be set. I'm trying to deploy with ant, with 'ant clean deploy', but I get an error in my terminal:
Error: Could not find or load main class org.apache.tools.ant.launch.Launcher
I've tried "source /etc/environment". Running 'echo $ANT_HOME' shows the correct path. I've tried moving ant to a different location and resetting the variables. Nothing. I'm kind of lost. Please help!
you should define $ANT_HOME before using it in your $PATH
JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-i386"
ANT_HOME="/opt/ant"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$ANT_HOME/bin"
double check that you have ant-launcher.jar under $ANT_HOME/lib
As others have stated, it looks like ANT_HOME isn't being set before you declare it in your path.
I take a slightly different approach to these things. Instead of constantly updating my PATH, I usually set my path to something fairly simple:
PATH="/usr/local/bin:/bin:/usr/bin/:$HOME/bin"
Then, I make hard links to various binaries into my /usr/local/bin directory.
$ cd $ANT_HOME/bin # All the Ant binaries
> for binary in *
> do
> sudo ln -s $PWD/$binary /usr/local/bin
> done
Now, I don't have to add $ANT_HOME/bin to my $PATH. Even better, if I include /usr/local/bin before /usr/bin and /bin, I am picking the binary in /usr/local/bin first. This way, I can ensure I run the version I installed over the default. For example, my machine comes with Ant 1.7 in /usr/bin/ant but I want to use Ant 1.9.1. I can install Ant 1.9.1, and that will be my default version.
I had same error when install ant with npm install. When I tried install from official repository throw pacman -S apache-ant(apt-get install apache-ant -- for Debian/Ubuntu) it's start working proper for me.
I'm experiencing this bug with jdk 1.8. But, I came across this RHEL 6.5 bug for OpenJDK 1.8 which may be related:
https://bugzilla.redhat.com/show_bug.cgi?id=1149605
Essentially, it's fixed in jpackage-utils-1.7.5-3.13 which is included with RHEL 5.7.
The problem, as Javier Ramirez said in the bug comments:
Your script /usr/share/java-utils/java-functions has problems with
"openjdk version" because it expects "java version" as Java 7 does.
$ mkdir /usr/share/java-1.8.0
$ mkdir /usr/lib/java-1.8.0
$ diff /usr/share/java-utils/java-functions.orig /usr/share/java-utils/java-functions
149,150c149,150
< -e '/java \(full \)*version "/s/'$re'/<<<\1>>>/' \
< -e '/java \(full \)*version "/s/.*<<<\([^>]\{1,\}\)>>>.*/\1/p')
---
> -e '/[java|openjdk] \(full \)*version "/s/'$re'/<<<\1>>>/' \
> -e '/[java|openjdk] \(full \)*version "/s/.*<<<\([^>]\{1,\}\)>>>.*/\1/p')
------
I am using RHEL which comes with ant (in /usr/bin/ant) and the ant libraries in
/usr/share/ant. As suggest above, ant -version gave the "could not find" error.
I installed my own version of ant (in /home/Ant since I have a lot of space
in /home) and put ANT_HOME in my .bash_profile and $ANT_HOME/bin in my PATH
and $ANT_HOME and $ANT_HOME/bin (for good measure) in my CLASSPATH. Then ant
worked (when used as myself, not as root).
I have made a jar file which i tested in windows and it works fine. now i want to test it for red hat enterprise linux 5. but i dont know how to run jar files in rhel5.
i've tried java -jar My.jar but it says bash: java: command not found. i've set JAVA_HOME variable as export JAVA_HOME=/root/jdk1.6.0_21 but still not working.
can anybody tell me how to run jar file in rhel5?
You need to set PATH variable , something like
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
replace /usr/java/jdk1.5.0_07/bin with path to your jdk's bin directory.
The problem is your terminal tries to find java command from the PATH , but it couldn't find it.
Update:
You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:
# vi /etc/profile
Next setup PATH / JAVA_PATH variables as follows:
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Top tip but slightly off topic.
1) Install your JDK in /usr/local/jdkX.X.X_XX/
2) Create a symbolic link /usr/local/java -> your chosen JDK installation
When you install new versions of java or if you want to revert to an older version, just change the symbolic link.
I created one jar file in following location: '/usr/local/bin/niidle.jar'
But when I type command as follows:
jar tf /usr/local/bin/niidle.jar
then it shows the following error:
--The program 'jar' can be found in the following packages:
* java-gcj-compat-headless
* gcj-4.2
* sun-java5-jdk
* kaffe
* gcj-4.3
* cacao-oj6-jdk
* openjdk-6-jdk
* fastjar
* sun-java6-jdk
Try: apt-get install <selected package>
bash: jar: command not found
Do you have a solution for this?
Apparently the jar program is not found by the operating system. Have you installed any of the packages containing it, and set up your path correctly?
In order for the OS to find an executable, the path environment variable must include the directory where that program is located. Otherwise you need to specify its full path to access it.
Well, it can't find the jar program. Perhaps your JDK isn't on the path, or you haven't installed one? If you have installed one, try to find where it is, and look in there for the jar program.
Try runnning "java -jar /usr/local/bin/niidle.jar"
On Ubuntu 12.10 The program jar is in /usr/lib/jvm/jdk-[version]/bin
edit the file /etc/environment for add to the path. Close the session and open a new session.
You seems to be using either Debian or Ubuntu. And it is telling you that you did not install one of the packages containing the 'jar' executable. You will have to install one corresponding to the java package you use on your system. In order to know which java package you already have type this : dpkg -l | grep java
If you are like me and you already have everything installed, but you just get the same error when trying to type jar: it should be listed in your PATH.
Run echo $PATH.
If you're like me, it does not contain the entry like this /usr/lib/jvm/jdk1.8.0_66/bin.
Make sure it's not $JAVA_HOME/bin, all variables should be expanded!
If you don't have the entry, but have JAVA_HOME set, run export PATH=$PATH:$JAVA_HOME/bin
See if you got the jar command.
If it does, google about environment variables to set that effect forever.
Have a nice day.