MATLAB: Can’t I connect to Bloomberg in MATLAB R2015a using B-PIPE

bloombergblpapiblpapi3.jarbpipeDatafeed Toolboxsetauthenticationoptions

I am trying to connect to Bloomberg in MATLAB R2015a using the "bpipe" function and it produces the following error:
No appropriate method, property, or field 'setAuthenticationOptions' for class 'com.bloomberglp.blpapi.SessionOptions'.
Error in bpipe (line 85)
sessionOptions.setAuthenticationOptions(authOptions);
Error in bpipe_test (line 8)
c = bpipe(authtype,appname,serverip,portnumber);

Best Answer

This error can be caused by MATLAB referencing an outdated version of the Bloomberg API which is located in a Java archive file named "blpapi3.jar". For newer MATLAB releases, you may see the following error instead:
Undefined function or variable 'setAuthenticationOptions'.
Error in bpipe (line 85)
sessionOptions.setAuthenticationOptions(authOptions);
You can execute the following command into the MATLAB command window to obtain a list of all files in MATLAB's Java path:
>> javaclasspath
From the output of the statement above, you can verify that the "blpapi3.jar" file is located in the expected directory. One potential issue may be that MATLAB is referencing a an older "blapapi3.jar" file that was used with a previous MATLAB version. For example, if you are currently using MATLAB R2015a and your "blpapi3.jar" is located in a MATLAB R2014b directory, this indicates that MATLAB may be using an older version of the API.
If you need to update the location of the "blpapi3.jar" file listed in the Java path, the approach will depend on if the file is listed in the static or dynamic Java path. You can determine this from the output of the "javaclasspath" statement above.
To update a "blpapi3.jar" file listed in the static path, you can edit the corresponding entry in the "javaclasspath.txt" file located in the MATLAB preferences directory. The preferences directory can be found by executing the following statement in the MATLAB command window:
>> prefdir
To update a "blpapi3.jar" file listed in the dynamic Java path, you will first need to determine where the entry is being added to the path. In most cases, this is accomplished in MATLAB's "startup.m" file. You can open the "startup.m" file by executing the following command into the MATLAB command window:
>> edit startup
You can then update any lines that add "blpapi3.jar" to the Java path:
>> javaaddpath('<PATH>\blpapi3.jar');
where "<PATH> " is the new path to the latest Bloomberg API file. If the "blpapi3.jar" in the dynamic Java path is not being added in "startup.m" then you will need to determine if it is being added by a script or function that you are using.
If you are certain that the path to "blpapi3.jar" in your MATLAB Java path is referencing the most current version of the API on your system, then you may need to download the latest version directly from Bloomberg. You can do this by following the instructions listed in the link below: