ERROR: Could not find or load main class

Hai. I have a problem regarding Logstash start. Before this when i use Logstash for ingestion, everything works well. but now, the Logstash seems having problem with java where the error as followed:

  1. I already have jre11 for jar file in lib.
  2. I already added java as JAVA_HOME
  3. I already reinstall logstash but no changes in error.

Do anyone have idea to solve this issue? Its important for me as I use this Logstash most of the time to ingest data for testing.

Hello @Wan_Nur_Athirah_Wan

in command prompt could you execute javac -version and java -version

if the command output ended up with errors , there is issue with java.

Keep posted!!! Thanks !!!

Screenshot (690)
Hai @sudhagar_ramesh . thanks for the reply. here is my screenshot for checking the java. there is nothing error occur when checking it

Hello @Wan_Nur_Athirah_Wan

Inorder to launch logstash , you have to use "logstash" command which will use that file in bin folder called as "logstash" with the file type "file"

Hence please make use of below code snippet


path =>"G:/XXXX/XXX/<your-file.txt>"
start_position =>"beginning"

codec => rubydebug

    hosts => "localhost:9200"
	user => "<your-es-username>"
	password => "<your-es-pwd>"
	index => "<your-index-name>"

run that config file with this command logstash -f Example1.conf

Keep Posted !!! Thanks !!! :slight_smile:

1 Like

Thanks @sudhagar_ramesh for the help. I will look into it using this suggestion. Right now i just ingesting data using python script align with Elasticsearch.

1 Like

Hello @Wan_Nur_Athirah_Wan

Good day!!!

Hope you have tried the suggestion and looking forward on the results

Hi @sudhagar_ramesh . I just have time to look back the error. when i tried to run it, the error still the same. It cannot find the path of this logstash file. I believe if it cannot find this path, the whole thing that we want to run using logstash cannot been done. I found one topic related to this error, but theres no solution and the topic also already closed

Could you get the path where logstash is in and set it as environment variables .

Just copy the path -> goto advanced settings -> path (under System Variables) -> paste the path and save it

then in command prompt go to that drive where it is in and just type logstash

Keep Posted!!! Thanks!!!

I already create a path for logstash by pasting the path into system variables. and run the logstash. here the result:

could you try with this below command

logstash -f .\config\logstash_wl_general.conf

here the result:

C:\Users\Lenovo\Documents\elasticsearch-7.3.1-node-test\logstash-7.3.1>logstash -f .\config\logstash_wl_general.conf
'logstash' is not recognized as an internal or external command,
operable program or batch file.

Just go to bin path of logstash and then execute

Sorry @sudhagar_ramesh . but when I just execute it in bin folder, the command just disappeared. and when i execute by typing manually in command, the error still the same. cannot find the main class


the issue with java then, please reinstall your java to fix this issue.

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