I'm working on getting a Cassandra instance up and running, but i'm having issues telling Cassandra which Java installation to use. The situation is as follows:
The server has Java 6 installed, and all Java environment variables are pointed to this installation ($JAVA_HOME, etc). This installation is what every other program on the server utilizes right now.
Java 7 is also installed, in a separate location, but is not the version used by default.
I've attempted to dig into the cassandra-env.sh script in $CASS_HOME/conf and the cassandra script in $CASS_HOME/bin, but I haven't had much luck finding a place to specify a different $JAVA_HOME directory. Does anyone have experience with doing this sort of thing with Cassandra?
I did finally find this setting:
In the $CASSANDRA_HOME/bin dir, there is a file called cassandra.in.sh, there is a section that looks like this:
# JAVA_HOME can optionally be set here
JAVA_HOME=/usr/local/jdk6
You can modify this to have Cassandra use a different Java installation.
Related
I was working on my project that uses Cassandra and Redis as databases when I needed to reinstall Windows. On previous installation of Windows everything worked with Cassandra but now when I have latest Java and JAVA_HOME, JRE_HOME set up. I have Cassandra 3.11.1 unpacked and ready to go but when I try to start a server I get:
EXCEPTION_ACCESS_VIOLATION (0x0000005) error that has been encountered by Java Runtime Environment.
I have read that this was merely a memory problem when I looked up starting parameters for JRE that was blank so I set the parameters as -Xmx2048m.
I had similar problem. Using latest Java 8 instead of 9 fixed it. Specifically I have JAVA_HOME pointing to jdk1.8.0_171 instead of jdk-9.0.4.
I am using smartGIT in Windows 8.1 which uses 32Bit JDK (1.8), I needed to set JAVA_HOME to 32bit directory
but now Im using as well Android Studio which needs JDK 64bit (1.8 installed), and I need to set JAVA_HOME pointing to 64bit directory
is there a way to set them both on the same variable and depending if the software requires either JDK 32 or 64 can pick the appropriate framework???
I tried to set them simultaneously by separate them with a semi colon like this
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_25\;C:\Program Files (x86)\Java\jdk1.8.0_25
but this just works with 32BIT version, 64BIT is still doesn't work
thanks for the support
This is not a direct answer to your question. But I think this will help you to solve the underline problem of running SmartGit on 64bit JVM.
Go to bin folder under SmartGit installation directory. There you can find the "smartgit64.exe" executable to launch SmartGit in 64bit mode.
I have it running smoothly in Win8.1 64bit with 64bit JDK.
There is no way to have a static JAVA_HOME that satisfies version or bitness specific subprocess that I know of.
You don't say what platform you are on, but generally environment variables exported such that subprocesses can use them are fixed, are used as a basis for further tweaks, or are completely redefined.
But, what you can do is try to tweak the environment that those processes are called from so they have their own custom environment. For example, you could have your own JAVA_ROOT set, andf then use that as a basis for creating JAVA_HOME along with a hard-coded or script/function fetched environment variable for a specific JRE to make the "real" JAVA_HOME for everything run from this subshell.
Alternatively, if you are on OS X, there is a utility that can be used to set and fetch system information for installed JREs. This can be used in scripts, etc. Other platforms have similar tools.
Also, look hard at your toolset. Make sure that JAVA_HOME is the only way to set the VM it uses -- often this is just one of the ways you can set this.
[EDIT]
I forgot about the -d32 trick mentioned in the comments. That would be nice solution if it works, and you can use the same versions of the VM for all invocations.
[EDIT]
Ok, since you are on Windows, you could try launching each Java app from its own environment. A .cmd or .bat file if that is the way you roll, or you could create a Windows shortcut that you tweak before invoking the specific app.
For example, if one has a Java main they want to run from the command line, it is easy to wrap the entire command line in a .bat file. e.g.:
set JAVA_HOME=C:\Some\Path\To\A\JRE
set APP_HOME=C:\Some\Path\To\A\Jar
set JAVA_OPTS="-Dfoo=bar"
%JAVA_HOME%\bin\java.exe %JAVA_OPTS% -jar %APP_HOME%\myApp.jar
Now, running this jarfile will use the specific Java executable you set, and also pass the new JAVA_HOME environment to the Java process that it starts. This overwrites any "default" JAVA_HOME you have set in your User or System environment.
Any other processes will not see this JAVA_HOME, and when the .bat file exits the new definition disappears.
Alternatively, if you always start your Java apps or Java tools by double-clicking them, you might be able to wrap those applications in a Windows shortcut -- even if you just prepend the executable with "set JAVA_HOME=..." I always forget how tweaky this is, though, so I'm hand-waving a bit!
I'm sure this has a relatively simple answer -_- , but I keep getting a ton of errors and I have no idea why.
Here is the guide I am following:
http://akbarahmed.com/2012/05/12/install-pentaho-bi-server-4-5-on-windows-7-x64/
I am using Java 1.8.0.05, and biserver-ce-5.0.1-stable
When I run start-pentaho.bat, and the Tomcat window opens, I get a whole host of errors.
If I go to localhost:8080/pentaho, I get the following errors:
One or more system listeners failed. These are set in the systemListeners.xml.
org.pentaho.platform.api.engine.PentahoSystemException: PentahoSystem.ERROR_0014 -
Error while trying to execute startup sequence for
org.pentaho.platform.repository2.unified.BackingRepositoryLifecycleManagerSystemListener
I have gone through this entire process 3 times, but nothing seems to work.
There are 3 things you have to take care of:
When running on windows, it is easy to run into Windows' path-length limitation. This then will break the jar-loading which in return gives you random errors as the Tomcat server cannot find the classes contained in these jars. So when you install, do not install it deep into a directory, keep it at the root of your disk. From hard experience, I now always install it in DRIVE:\Pentaho
The Server will not run without the system database. If your logs show you a Quartz-Error, or a Hibernate error, then your HSQL database is not running. In the download, you'll find a "data" directory. Start the "start-hypersonic.bat" before you start the main Pentaho server.
Pentaho does not run with Java 8. There seem to be some incompatible changes in the JDK and I have not been able to actually start it up correctly. You have to use JDK 1.7 to be successful. ALso make sure that your JAVA_HOME or PENTAHO_JAVA_HOME points to the correct JDK.
The Pentaho bat files try to locate a Java installation automatically, and without explicitly setting these environment variables, any JDK may be picked up at random. Usually that is the last JDK that has been installed or updated. So to be safe, lock down the JDK by setting these variables (via Control Panel-> System -> Advanced System Settings -> Environment Variables)
You need to check the catalina.out and pentaho.log files (both should be at biserver-ce/tomcat/logs).
They'll give you more detail on why the server is not starting.
I was having the same error when I installed Java 8 and even after I reinstall Java 7 without removing Java 8 completely.
Remove all Java installations, then you install Java SDK 7
Set the environment variable PENTAHO_JAVA_HOME as your Java 7 path
Then you reboot your computer
Then you start Pentaho BI Server
Hope this help you.
BTW, don't use IE or Safari.
How can I specify that in order to run a certain java application that I created you need to have 32 bit JRE installed on your system? Further how can I specify that the java application is to use the 32 bit JRE and not the 64 bit JRE if they are both installed?
Background:
I have created an application that uses a 3rd party 32 bit only library. The application can not run in a 64 bit JRE.
I am going to be distributing this application to a lot of computers in my company, so I need to be able to in code or in the export process, specify the required JRE.
I am using eclipse, Kepler to develop and build the java application.
The idea of java is always compile once and run everywhere, regardless of OS, cpu architecture etc, so you might be heading the wrong direction here.
But nevertheless here are some system properties you might / not find helpful. I've listed the property key and value I have when I check it (I run Oracle JDK on Win7 64)
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
sun.arch.data.model: 64
sun.cpu.isalist: amd64
To use any of those just do
String vmname = System.getProperty("java.vm.name");
You can't do it directly in Java, since you're in a running JVM at that point. My solution was to write a dos batch script to set the JAVA_HOME and add %JAVA_HOME%\bin at the front of the PATH. For example, I have sethome.bat which contains
#echo off
set "JAVA_HOME=c:\Program Files (x86)\Java\jre6"
set "PATH=%JAVA_HOME%\bin;%PATH%"
Then I use
call "%SERVICE_HOME%\sethome"
"%JAVA_HOME%\bin\java" -version
echo If this does not look correct press CTRL-C to cancel otherwise
pause
You cannot generally make sure what program runs your jar. I can pass the jar to acroread, or zip or whatever, and you can't do anything about it.
So, I'd just try to load the library, and do a proper error/exception handling. Who knows? Maybe your client has meanwhile replaced that library with a 64bit version, without you knowing about it? SO, this: loading, and if it won't aborting with a graceful eror message is the only sensible thing.
How can I write a program to detect whether Java is installed on a Windows machine? I need to know because if it is not installed, then I have to install it using an embedded Tomcat.
The easiest way is through the browser.
You can use or see how this official Verify Java page detects Java availability and version from inside a browser.
LE: For some explained code and examples you can also check http://javatester.org/.
See whether the environment variables JAVA_HOME or JRE_HOME exist and point at an existing directory with a bin subdirectory
See whether the system PATH contains any directory in which there is a java.exe
In both cases you can additionally try to run the java executable with the -version command line option and check the output.
You can write a program to check Windows registry. There should be paths to different java versions under HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft.
Obviously this should be done in something else than java.
Just write a small script / batch file to execute java , if java is not installed, it'll throw an error, else if its installed it would give usage.