function err = javachk(requiredLevel, component)
%JAVACHK Validate level of Java support.
%   MSG = JAVACHK(REQUIREDLEVEL) returns a generic error message if
%   the required level of Java supoport is not available.  If it
%   is, it returns an empty matrix.  REQUIREDLEVEL should be a
%   vaild input argument for USEJAVA.  
%
%   MSG = JAVACHK(REQUIREDLEVEL, COMPONENT) returns an error
%   message using the COMPONENT string appropriately if the required
%   level of Java supoport is not available.  If it is, it returns
%   an empty matrix.
%
%   See also USEJAVA

%   Copyright 2000 The MathWorks, Inc.
%   Revision: $  $Date: 2000/06/01 04:26:43 $

% Check for vaild argument list
narg_err = nargchk(1, 2, nargin);
if (~isempty(narg_err))
    error(narg_err);
end

% Assume that everything will work.
err = [];

% If we're running at an insufficient level, report it.  If no
% component name was supplied, make up a generic one.
if ~usejava(requiredLevel)
    if nargin == 1
        component = 'This feature';
    end
    err = [component ' is not supported on this platform.'];
end
%   $Revision: 1.2 $  $Date: 2000/06/01 04:26:43 $
