Error when running box coldbox create app myApp command

When I was attempting to create my app using commandBox I ran into an issue when i used the “box coldbox create app myApp” command. It it throwing the following error:

Exception in thread “main” java.io.FileNotFoundException: /Users/danielroemer/Sites/lol/coldbox (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileReader.(FileReader.java:72)
at cliloader.LoaderCLIMain.removeBinBash(LoaderCLIMain.java:367)
at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:276)
at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:231)

I attempted to troubleshoot but was unable to resolve the issue. I was in the proper director when I ran the command. The “box install coldbox-be” command worked perfectly that I ran prior.

Any help would be greatly appreciated!

Thanks in advance!
Dan

Dan, does the command run if you execute it from the interactive shell?

$> box
ComandBox > coldbox create app myApp

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Yes that worked for me. Looks like it was just an issue when I’m not in the interactive shell.

I think I know what the issue is. There are some checks when the Java wrapper on CommandBox starts up to try and “detect” if the first part of what you typed is an actual file. If so, it tries to run that file as a .cfm file.

Example, you can execute .cfm file like so:
box execute foo.cfm

To make that simpler like other CLIs we also allow you to just type this:
box foo.cfm

The code linked below basically tests the first parameter “foo.cfm” and sees if it is a java.io.File that exists() and if so it tries to execute it directly instead of parsing the parameters as a command.

https://github.com/denuno/railo-cli/blob/master/src/java/cliloader/LoaderCLIMain.java#L261

The problem is that java.io.File can also represent directories. (It really should have just been called “Path” in my opinion). Since you already installed Coldbox, the “coldbox” part of “coldbox create app myApp” is being matched as a “File” and the shell is trying to load and execute it.

The fix is we need to ALSO check .isFile() on it.

As a short term workaround, you can not install ColdBox first and use the --installColdBox flag on the “coldbox create app” command, Or just run the “coldbox create app” and “install coldbox” commands in the opposite order.