Fei
Fei

Reputation: 495

cassandra 2.1.1 on Mac terminal

I got the following warnings, but don't understand why. It appears I have Java 7U71.

LNGRDUM-4157808:bin xyx$ ./cassandra -f
Cassandra 2.0 and later require Java 7u25 or later.

LNGRDUM-4157808:bin xyz$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Upvotes: 2

Views: 970

Answers (2)

Chris Sladky
Chris Sladky

Reputation: 31

What I don't know is why it says you need to upgrade, even though it appears that your Java version is up to date. What I do know is that I had a similar issue recently, and I resolved it this way:

  1. Install the latest JRE from https://www.java.com/en/download. This will install the latest version of Java, but it will NOT update the default "java" used by Terminal/bash, and so Cassandra won't pick it up.
  2. To make Cassandra and Terminal use the newest version, add the latest install to your $PATH. This is complicated for a few reasons. First, it's not obvious where Java installs itself, and it ISN'T to the default /user/bin/java location. It turns out that it's in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin. Second, there's a space in the directory, so you have to be careful about that.

    Theoretically, it should be possible to edit your $PATH by editing /etc/paths. However, I was not able to get this to work (maybe something to do with the space in the directory?). Instead, I ended up editing my $PATH a different way, as shown here. The line in my .bash_profile looks like this:

    export PATH="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin":$PATH
    

    If you have any trouble doing this, just let me know.

  3. Test that you've done this properly by opening a new Terminal (this is important as it will reload your .bash_profile), then typing java -version. Hopefully this now displays an even newer version than before. You can double-check that java is being sourced from the right place, and you've successfully modified your $PATH, by typing which java.

Doing that fixed my Cassandra. Hopefully it will fix yours, too.

Upvotes: 2

catpaws
catpaws

Reputation: 2283

You must have multiple Java versions installed. Check your PATH setting and change it to point to the correct version:

LNGRDUM-4157808:bin xyx$ SET
. . . 
PATH=<bunch of stuff>:/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin

If JAVA_HOME is set (doesn't need to be for running Cassandra), make sure it isn't pointing to a different Java installation.

Upvotes: 1

Related Questions