[MarkLogic Dev General] Problem adding my own JAR to MLJAM

Neil Bradley neil at bradley.co.uk
Mon May 12 00:10:53 PDT 2008


It works fine now, thanks. 

I was so sure that there was some complicated setup requirement that I was
missing, that I neglected to check that my code was correct. This is a
reminder to always check the simplest things first!

Thanks again,

Neil.


-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Jason Hunter
Sent: 12 May 2008 05:26
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Problem adding my own JAR to MLJAM

Here's your code:

>     package neil.test;
> 
>     final public class UpperCase {
>     String _TheString = "";
>     public UpperCase(String TheString) {  _TheString = 
> TheString.toUpperCase(); }
>     public String GetUpperCase() {  return _TheString;  }
>     }

Here's your use of it:

>     jam:eval-get('{
> 
>       import neil.test.UpperCase;
> 
>       UpperCase UC = new UpperCase();
> 
>       String U = "hello: " + UC.GetUpperCase("Testing Testing");
> 
>       return U;   
> 
>     }')

Here's your error:

>     Typed variable declaration : Constructor error: Can't find default 
> constructor for: class neil.test.UpperCase  on line 1,

A "default constructor" is the constructor that takes no arguments. 
You're calling it as "new UpperCase()".  In your code above you didn't 
provide that constructor.  So the error is simply that you're calling a 
constructor that doesn't exist.

You can call new UpperCase("Testing Testing").GetUpperCase() and it'll work.

-jh-
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general



More information about the General mailing list