The input line is too long when starting kafka

I'm trying to run Kafka message queue on Windows.

I'm usin this tutorial - https://dzone.com/articles/running-apache-kafka-on-windows-os

When i try to run it with comand - .\bin\windows\kafka-server-start.bat .\config\server.properties

and i get an error: The input line is too long. The syntax of the command is incorrect.

kafka location - C:\kafka_2.11-1.0.0


This is because of the long length of the path because of the folder name 'kafka_2.11-1.0.0'. Just rename the folder to something small, like just 'kafka'.


The Problem

The kafka-run-class.bat file performs a bunch of CLASSPATH :concat calls that make the CLASSPATH very long.

Depending on your environment, too long: Windows cmd.exe environment has a limit of 8191 characters.

Solutions

Edit kafka-run-class.bat so that ...

  1. make it so that CLASSPATH is not used or set elsewhere
  2. make paths shorter so that concat produces a string smaller than than 8191 characters
  3. make concat use the whole folder instead of every single jar (via libs/*)

Example

Here is an example of an edit to kafka-run-class.bat (source) that uses the 2nd approach:

replace ...

rem Classpath addition for release
for %%i in ("%BASE_DIR%\libs\*") do (
    call :concat "%%i"
)

... by this ...

rem Classpath addition for release
call :concat "%BASE_DIR%\libs\*;"

Above both options didn't work for me.

I have just moved an unzipped directory to C:/ drive and started power shell in Administrator mode and tried the desired commands, the zookeeper and broker started smoothly.