When I try to create a new java Azure Function project I keep getting the following error about a missing .jar file. I have verified the .jar file exists and I have also verified it is named correctly. I only get this error after the function compiles and I try to reach the endpoint. I know if I re-create the project there is a change that the error will resolve itself but I'm trying to understand the root cause.
[10/24/18 11:10:10 PM] Executed 'Functions.HttpTrigger-Java' (Failed, Id=1111111-1111-1111-1111-EV0111d6f03)
[10/24/18 11:10:10 PM] System.Private.CoreLib: Exception while executing function: Functions.HttpTrigger-Java. System.Private.CoreLib: Result: Failure
[10/24/18 11:10:10 PM] Exception: IOException: The jar URL "file:/Users/USER/Documents/Workspace/FUNCTIONNAME/target/azure-functions/FUNCTIONNAME/FUNCTIONNAME-1.0.jar" being added does not exist.
[10/24/18 11:10:10 PM] Stack: java.io.IOException: The jar URL "file:/Users/USER/Documents/Workspace/FUNCTIONNAME/target/azure-functions/FUNCTIONNAME/FUNCTIONNAME-1.0.jar" being added does not exist.
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.reflect.DefaultClassLoaderProvider.addUrl(DefaultClassLoaderProvider.java:61)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.addSearchPathsToClassLoader(JavaFunctionBroker.java:58)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.loadMethod(JavaFunctionBroker.java:30)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:27)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.handler.FunctionLoadRequestHandler.execute(FunctionLoadRequestHandler.java:9)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:45)
[10/24/18 11:10:10 PM] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:91)
[10/24/18 11:10:10 PM] at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
[10/24/18 11:10:10 PM] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
[10/24/18 11:10:10 PM] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
[10/24/18 11:10:10 PM] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
[10/24/18 11:10:10 PM] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[10/24/18 11:10:10 PM] .
It seems like Visual Studio Code does not handle spaces correctly in file paths. If you remove spaces from any of your filenames/folders then it should fix this error.