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

**URL:** <https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137>\
**Category:** Logstash\
**Created:** [April 16, 2019, 6:16pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137 "2019-04-16T18:16:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 16, 2019, 6:16pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/1 "2019-04-16T18:16:55Z")

</div>

... 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

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 16, 2019, 6:47pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/2 "2019-04-16T18:47:11Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 16, 2019, 8:01pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/3 "2019-04-16T20:01:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 16, 2019, 8:07pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/4 "2019-04-16T20:07:25Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 16, 2019, 8:31pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/5 "2019-04-16T20:31:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 16, 2019, 8:51pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/6 "2019-04-16T20:51:11Z")

</div>

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%
```

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 17, 2019, 2:45pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/7 "2019-04-17T14:45:42Z")

</div>

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](https://us1.discourse-cdn.com/elastic/original/3X/b/9/b9beb1ef79018ea98903c25154471a1fbf82d23f.jpeg)

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%

 ![Java2](https://us1.discourse-cdn.com/elastic/original/3X/a/7/a7238a6910504c248b12e3e09853807744eaa96a.jpeg)

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%

 ![Java3](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e88adfcecadcbec2fa4c8584c257637a004fff46.jpeg)

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

 ![Java4](https://us1.discourse-cdn.com/elastic/original/3X/d/9/d9371b08701e7e824d3b1b69a6aba5bb6156d8d1.jpeg)

What now?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 17, 2019, 3:11pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/8 "2019-04-17T15:11:12Z")

</div>

What do you get when you run this?

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

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 17, 2019, 3:17pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/9 "2019-04-17T15:17:59Z")

</div>

![Java5](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0ed83ed16241c4b7352791cddcf23e9c30e475cb.jpeg)

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 17, 2019, 3:19pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/10 "2019-04-17T15:19:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 17, 2019, 3:23pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/11 "2019-04-17T15:23:36Z")

</div>

could I perhaps try setting the following system variables:  
http\_proxy [http://localhost:3128](http://localhost:3128)  
https\_proxy [https://localhost:3128](https://localhost:3128)

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 22, 2019, 12:46pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/12 "2019-04-22T12:46:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 20, 2019, 12:46pm UTC](https://discuss.elastic.co/t/cannot-find-class-org-jruby-main-why-is-this-happening/177137/13 "2019-05-20T12:46:13Z")

</div>

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