drill icon indicating copy to clipboard operation
drill copied to clipboard

Drill cannot startup if java path contains whitespace

Open kingswanwho opened this issue 3 years ago • 6 comments

Describe the bug My JAVA_PATH set to "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home", when run ./drillbit.sh start, drill cannot startup and report error: /Users/Chester/Gwssi/ApacheDrill/apache-drill-1.19.0-SNAPSHOT/bin/runbit: line 109: /Library/Internet: No such file or directory
/Users/Chester/Gwssi/ApacheDrill/apache-drill-1.19.0-SNAPSHOT/bin/runbit: line 109: exec: /Library/Internet: cannot execute: No such file or directory

To Reproduce Steps to reproduce the behavior:

  1. set JAVA_PATH to a jdk path which contains whitespace:
    export JAVA_PATH=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
  2. startup drill:
    ./bin/drillbit.sh start
  3. See error in log file:
    log/drillbit.out

Expected behavior Drill cannot startup normally.

Screenshots image image

Desktop (please complete the following information):

  • MacOS Big Sur 11.2.3

Additional context print the command of line 109 in /bin/runbit: echo exec $BITCMD

See the print result in log/drillbit.out:
image The whitespace in java path doesn't come up with a backslash escape, so that exec cannot find the correct java path. After I set the java path to a jdk without white space, like:
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
Drill startup process back to normal.

kingswanwho avatar May 17 '21 13:05 kingswanwho

Please use Jira to publish bugs and improvement ideas: http://drill.apache.org/docs/apache-drill-contribution-guidelines/ https://issues.apache.org/jira/projects/DRILL/issues

The recommendation here:

Sometimes using the absolute path like C:\Program Files\Java\jdk1.8.0_131 can cause some ambiguity while installing a tool or running a script where JAVA is needed. So, using double quotes for the path is a wise choice. Also, you can set the JAVA_HOME path in the following ways if it contains space: C:\Program~1\Java\jdk1.8.0_131 Progra~1 = 'Program Files' Progra~2 = 'Program Files(x86)'

https://stackoverflow.com/questions/45660062/shoud-java-home-variable-contain-quotes-if-points-to-path-with-spaces

But anyway you can create a ticket and mark it is as minor

vdiravka avatar May 19 '21 17:05 vdiravka

@vdiravka There was a discussion about allowing users to post issues here and using JIRA to track actual work in progress.

It seems we should add this to the documentation however as I think people have run into this issue before.

cgivre avatar May 20 '21 13:05 cgivre

I think we can talk about solution for any idea here before we create the JIRA.

luocooong avatar May 20 '21 14:05 luocooong

@vdiravka Hi, thank you so much for your two solutions, include double quotes for the path and use a variable to replace the part which contains white space. I tried those two methods, but seems both of them cannot solved the problem. Maybe I could provide a screen record, so that you can help me to figure out anything wrong I did here.

kingswanwho avatar May 20 '21 17:05 kingswanwho

@kingswanwho Did you ever find a solution for this?

cgivre avatar Oct 19 '21 19:10 cgivre

@cgivre Hi Charles, unfortunately, I didn't find a solution so far. What I found now is, in MacOS, JDK installed by HomeBrew saves in path ”Internet Plug-Ins“ with a whitespace. And in Drill runbit script, BITCMD is composed by JAVA and other variable, so I think even use double quote to assign JAVA would not work when use JAVA to compose BITCMD. I have ever tried use regex to replace whitespace with "\ " in runbit, but still not work. What I did now is just use a java path without whitespace. If Drill needs to handle a java path with whitespace, I could try to find a solution.

kingswanwho avatar Oct 20 '21 03:10 kingswanwho