"Cannot find class org/jruby/Main." - why is this happening?!?

... when I type ./bin/logstash-plugin list
I get in response:

Cannot find class org/jruby/Main.
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jruby/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.findBootstrapClass(Native Method)
etc, etc.

My version of java is 1.8.0_151
I need to install the output exec plugin and this kind of error is preventing it

Set the environment variable DEBUG. Run bin/logstash-plugin and you should get something like

Using GEM_HOME=/usr/share/logstash/vendor/bundle/jruby/2.5.0
Using GEM_PATH=/usr/share/logstash/vendor/bundle/jruby/2.5.0
DEBUG: exec /usr/share/logstash/vendor/jruby/bin/jruby /usr/share/logstash/lib/pluginmanager/main.rb list
[...]

Then edit the file that is exec'd in the DEBUG line and (around line 129) uncomment

$JAVACMD -version

Then run bin/logstash-plugin again and see what version of java it found.

I am not a Java programmer. I am trying to set user environment varibles. What should the value of a new variable named DEBUG be. I need to give it a value.

The script just tests that its value is not empty, so you can make it any value you want. I just set it to 1

if [ "$DEBUG" ] ; then
  echo "DEBUG: exec ${JRUBY_BIN} $@"
fi

I set DEBUG as value 1 in the windows user environment variables dialog

I then typed the following in the ..logstash-6.6.0> folder:
./bin/logstash-plugin

I only got the same error responses as before on the console.

Sorry, I was assuming you were running on UNIX.

On Windows if JAVA_HOME is set in the environment it will use that, otherwise it looks in the path. If you create a .bat file containing the following and run it which java does it find?

if defined JAVA_HOME (
  set JAVA="%JAVA_HOME%\bin\java.exe"
) else (
  for %%I in (java.exe) do set JAVA="%%~$PATH:I"
)
echo %JAVA%

There was no JAVA_HOME environment variable set. However there was a CS_JAVA_HOME environment variable which was pointing to ...\jre1.8.0_45. I changed this variable:
Java1

I then ran the .bat file you sent:
if defined JAVA_HOME (
set JAVA="%JAVA_HOME%\bin\java.exe"
) else (
for %%I in (java.exe) do set JAVA="%%~$PATH:I"
)
echo %JAVA%

I then ran a modified version:
if defined CS_JAVA_HOME (
set JAVA="%CS_JAVA_HOME%\bin\java.exe"
) else (
for %%I in (java.exe) do set JAVA="%%~$PATH:I"
)
echo %JAVA%

After that I ran logstash-plugin list with the following disappointing result:

What now?

What do you get when you run this?

C:\ProgramData\Oracle\Java\javapath\java.exe -version

Then I am unable to explain why that error would occur.

could I perhaps try setting the following system variables:
http_proxy http://localhost:3128
https_proxy https://localhost:3128

This was actually a non-issue. All I had to do was:
1) Do a clean install (64 Bit [important]) of Java - latest version, while removing older versions.
2) Set JAVA_HOME environment variable properly.

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