Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with java

24 views
Skip to first unread message

Josué Leal Moura Dantas

unread,
Mar 22, 2011, 2:49:11 PM3/22/11
to dev-te...@lists.mozilla.org
I'm making an extension that calls a method of a java class in a jar through
of the Liveconnect. I got to make the call, but it only do the first time, the
second the following error is displayed "Error: uncaught exception:
java.lang.reflect.InvocationTargetException", can anyone help me?

--
Josué Leal Moura Dantas

Message has been deleted

Gertrude Aquilina

unread,
Mar 23, 2011, 9:57:44 AM3/23/11
to dev-te...@lists.mozilla.org, Josué Leal Moura Dantas
Hi, I'm doing a similar thing as well. Can you please send me a link of the tutorial or web pages you are following, if any. Thanks a lot it would be of great help!

Josué Leal Moura Dantas

unread,
Mar 23, 2011, 10:30:55 AM3/23/11
to Markus Doering, dev-te...@lists.mozilla.org
I've done thsis, but the strange thing is that the first call the function
works, but in the second time a mentioned error happens, I think it's
because in my method instantiate many objects of other classes, any other
suggestions?

2011/3/22 Markus Doering <mydo...@googlemail.com>

> Hi there,
>
> make a try-catch throug your code example. And catch this Exception with
> like this:
>
> Class Test {
>
> public static void myMethod (String test) {
>
> try {
> ...my Code
> } catch (Exception e) {
> e.printStackTrace
>
> }
> Use always the Generic Exception.
> Enable Browser-Plugin console and you get a correct Exception. You must do
> try and error!
>
> Good Luck!
>
> 2011/3/22 Josué Leal Moura Dantas <josueleal...@gmail.com>

>> _______________________________________________
>> dev-tech-java mailing list
>> dev-te...@lists.mozilla.org
>> https://lists.mozilla.org/listinfo/dev-tech-java
>>
>
>


--
Josué Leal Moura Dantas

Mestrando em Ciência da Computação (UFPA)
(94) 8117-0893

Josué Leal Moura Dantas

unread,
Mar 23, 2011, 4:04:24 PM3/23/11
to Markus Doering, dev-te...@lists.mozilla.org
I had already included all the jars that the class uses, but have I
instantiate the classes too? Even that I had alrealdy included the jars where
they are?

2011/3/23 Markus Doering <mydo...@googlemail.com>

> I created one JAR from my java project which i included in JavaScript.
> I was using other APIs in this java project with external Jars (like
> log4j). But this didn't work. I had to include all sourcefiles directly in
> my java project. Otherwise i got an Exception from the error console of
> Firefox.
> I used this tutorial:
> https://developer.mozilla.org/en/java_in_firefox_extensions
>
>
> 2011/3/23 Josué Leal Moura Dantas <josueleal...@gmail.com>
>
>> Yes, my code is using other jars, but have I to include them in javascript
>> code?
>>
>>
>> 2011/3/23 Markus Doering <mydo...@googlemail.com>
>>
>>> Do you use other projets-jars in your BuildPath? This wont work! You have
>>> to include this Sourcefiles directly into your package!
>>>
>>>
>>> 2011/3/23 Josué Leal Moura Dantas <josueleal...@gmail.com>

Josué Leal Moura Dantas

unread,
Mar 23, 2011, 4:32:40 PM3/23/11
to Markus Doering, dev-te...@lists.mozilla.org
I use a similar code, but as you said in jars I made a change and now I can
still run the extension by first time, but the second the following error
appears in the console "Erro: java.net.URL is not a constructor".

2011/3/23 Markus Doering <mydo...@googlemail.com>

> Maybe this will help:
> loadXpcom : function() {
> //Path des LiveConnect Moduls HINT: don't forget to register
> Livconnect modul in manifest
> Components.utils['import']('resource://verConSign/LiveConnectUtils.js',
> this.LiveConnect);
> var jars = ['URLSetPolicy.jar', 'Test.jar'];
> var [loader,urls] = this.LiveConnect.initWithPrivs(java,
> 'verCo...@passau.de', jars);
> myClass = loader.loadClass('Test');
> var myObj = myClass.newInstance();
> if (myObj == null) {
> } else {
> var binval = myObj.hello('Hello World test!');
> alert(binval);
> }
> return myObj;
> },

0 new messages