Logstash using custom Java

Hi guys!
I have a Linux (RHEL) server, where I have to use logstash 6 in order to send log files to Kafka. Unfortunately, I dont have sudo there, also it has Java 1.7 and it is difficult to upgrade since these are production servers.
I am running logstash from home directory, and I cannot find info how can I set it to be started with custom Java. I.e. startup-options config file doesnt work for me, because it is needed for startup and not for running instance.
What I can do - I can extract Java 1.8 and then to try run Logstash.
So my question is - how to bypass custom Java to start Logstash? Is it possible not to start Logstash with system defined Java?
E.g. i want to achieve smth like "bin/logstash -f logstash.conf JAVA_HOME=/home/myuser/somejdk/java". Or if this doesnt work, maybe Java can be defined in some config file, but I wasnt able to find out in which.

P.S. Some time ago I sucessfully started Logstash towards Kafka on other RHEL where Java 1.8 resides.

Have you tried JAVA_HOME=/home/myuser/somejdk/java bin/logstash -f logstash.conf?

Yes, it doesnt make any sence, it still runs with system-wide Java (1.7):
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/logstash/Logstash : Unsupported major.minor version 52.0

Even if I run JAVA_HOME=/some/unexisting/folder bin/logstash -f logstash.conf &, it still uses system Java.

I have found way how to start it. Correct command is:

JAVA_HOME="/your/java/path/to/jre" bin/logstash -f logstash.conf &

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.