Using Xerces in a plugin [message #289621] |
Tue, 09 August 2005 05:47  |
Eclipse User |
|
|
|
Originally posted by: vducloux.cosmosbay-vectis.com
Hi everybody,
I need to use Apache xerces in my plugin. I don't know how to "add" this
library so that my plugin works.
I get a "SAX2 driver class org.apache.xerces.parsers.SAXParser not found".
I read in one article that I have to create a separate plug-in to
contain the library and make my first plugin depend on this new one.
BUT, According to that article there should already be avalaible
dependencies for Xerces or ant...But I don't get it in the dependencies
list....
here is the article
linkhttp://www.informit.com/articles/article.asp?p=370626&am p;seqNum=12 :
Am I missing something ??
|
|
|
|
|
|
|
Re: Using Xerces in a plugin [message #289865 is a reply to message #289710] |
Thu, 11 August 2005 12:10   |
Eclipse User |
|
|
|
Originally posted by: newsgroups.pellaton.li
Hi
Step 4 is not missing - it's just a typo.
I don't know SAX2, but might it be that it is distributed in several jar
files. If it is, you must add all of them to your plugin.
Another reason could be: you need to copy the jar into the project in
order to succeed in step 5. If you add the dependency (step 3) to
"external jars", you cannot include it in step 5.
Hope this helps
Michael
Ducloux Victor wrote:
> Hi I decided to try your method, which is the most eclipse-like way to
> do this.
> But I get a
> "SAX2 driver class org.apache.xerces.parsers.SAXParser not found"
>
> As I saw that in the help you gave there where 5 steps and that step 4
> is missing, have by any chance forgotten to give me this step ? Could
> you send it please
>
> thanks very much !!!
> Victor
>
> Michael Pellaton wrote:
>
>>Hi Victor
>>
>>If you cannot add another plug-in, you can add the library directly
>>to your plugin, but that's just not the "Eclipse way" to add a
>>library. Technically it works.
>>
>>Michael
>>
>>Ducloux Victor wrote:
>>
>>
>>>Thanks Michael for the help, I'm gonna try that?
>>>By the way do you know of any other XML parser that I can use and that
>>>doesn't need to do this.
>>>
>>>It's because I can't take the decision of adding a plugin...
>>>
>>>thanks in advance....
>>>
>>>Victor
>>>
>>>Michael Pellaton wrote:
>>>
>>>
>>>
>>>>Hi
>>>>
>>>>At least my Eclipse 3.1 does not provide Xerces.
>>>>You can check this as follows:
>>>>- cd to your eclipse install dir
>>>>- cd to the "plugins" directory
>>>>- you will find "org.apache.ant" and "org.junit" but no xerces
>>>>
>>>>I do always wrap libraries in plug-ins and that works really well,
>>>>especially if many plugins require the same few libraries.
>>>>
>>>>Creating a library plug.in is really easy:
>>>>1. create a new plug-in project
>>>> - uncheck "Create a java project"
>>>> - set the ID to the library name
>>>> - set the version to the library version
>>>> - set the name to the name of the library
>>>> - do not use a template
>>>>2. add your jar(s) to the build path of the plugin
>>>> (make sure they are exported)
>>>>3. edit the plugin.xml, switch to the tab "Runtime":
>>>> - add the library
>>>> - make sure it is re-exported
>>>>5. switch to the tab "Build":
>>>> - make sure the library is included in the binay build
>>>>
>>>>Now just make your plugin using the library depending on the plugin you
>>>>just cdreated. The RCP framework will then make sure the library plug-in
>>>>is loaded before your plugin at runtime.
>>>>
>>>>Hope this helps
>>>>
>>>>Michael Pellaton
|
|
|
Re: Using Xerces in a plugin [message #289868 is a reply to message #289865] |
Thu, 11 August 2005 12:42   |
Eclipse User |
|
|
|
Originally posted by: mmvjose.gmail.com
Hello.
I posted another article
( http://www.eclipse.org/newsportal/article.php?id=43695&g roup=eclipse.platform#43695)
where I described a situation with the same problem...
I tried to follow your steps to create a "library plug-in" but it still
does not work.
I found an old bug report
( https://bugs.eclipse.org/bugs/long_list.cgi?buglist=36643#c2) where this
problem is discussed and aparently the bug was resolved. The strange thing
is that I still have this problem (using Eclipse 3.0.1) and in the report
is mentioned that jdom doesn't work due to this problem... but I'm using
it to in my plug-in and it works. Only xerces won't work.
Can You help me?
Thanks,
Marco
-----
Michael Pellaton wrote:
> Hi
> Step 4 is not missing - it's just a typo.
> I don't know SAX2, but might it be that it is distributed in several jar
> files. If it is, you must add all of them to your plugin.
> Another reason could be: you need to copy the jar into the project in
> order to succeed in step 5. If you add the dependency (step 3) to
> "external jars", you cannot include it in step 5.
> Hope this helps
> Michael
> Ducloux Victor wrote:
>> Hi I decided to try your method, which is the most eclipse-like way to
>> do this.
>> But I get a
>> "SAX2 driver class org.apache.xerces.parsers.SAXParser not found"
>>
>> As I saw that in the help you gave there where 5 steps and that step 4
>> is missing, have by any chance forgotten to give me this step ? Could
>> you send it please
>>
>> thanks very much !!!
>> Victor
>>
>> Michael Pellaton wrote:
>>
>>>Hi Victor
>>>
>>>If you cannot add another plug-in, you can add the library directly
>>>to your plugin, but that's just not the "Eclipse way" to add a
>>>library. Technically it works.
>>>
>>>Michael
>>>
>>>Ducloux Victor wrote:
>>>
>>>
>>>>Thanks Michael for the help, I'm gonna try that?
>>>>By the way do you know of any other XML parser that I can use and that
>>>>doesn't need to do this.
>>>>
>>>>It's because I can't take the decision of adding a plugin...
>>>>
>>>>thanks in advance....
>>>>
>>>>Victor
>>>>
>>>>Michael Pellaton wrote:
>>>>
>>>>
>>>>
>>>>>Hi
>>>>>
>>>>>At least my Eclipse 3.1 does not provide Xerces.
>>>>>You can check this as follows:
>>>>>- cd to your eclipse install dir
>>>>>- cd to the "plugins" directory
>>>>>- you will find "org.apache.ant" and "org.junit" but no xerces
>>>>>
>>>>>I do always wrap libraries in plug-ins and that works really well,
>>>>>especially if many plugins require the same few libraries.
>>>>>
>>>>>Creating a library plug.in is really easy:
>>>>>1. create a new plug-in project
>>>>> - uncheck "Create a java project"
>>>>> - set the ID to the library name
>>>>> - set the version to the library version
>>>>> - set the name to the name of the library
>>>>> - do not use a template
>>>>>2. add your jar(s) to the build path of the plugin
>>>>> (make sure they are exported)
>>>>>3. edit the plugin.xml, switch to the tab "Runtime":
>>>>> - add the library
>>>>> - make sure it is re-exported
>>>>>5. switch to the tab "Build":
>>>>> - make sure the library is included in the binay build
>>>>>
>>>>>Now just make your plugin using the library depending on the plugin you
>>>>>just cdreated. The RCP framework will then make sure the library plug-in
>>>>>is loaded before your plugin at runtime.
>>>>>
>>>>>Hope this helps
>>>>>
>>>>>Michael Pellaton
|
|
|
Re: Using Xerces in a plugin (Resolution !!!) [message #289872 is a reply to message #289868] |
Thu, 11 August 2005 13:39  |
Eclipse User |
|
|
|
Originally posted by: mmvjose.gmail.com
Hi everybody.
I solved the problem by adding the following line:
Thread.currentThread().setContextClassLoader(this.getClass() .getClassLoader());
just before calling the method where Xerces is used.
Greetings!
Marco
|
|
|
Powered by
FUDForum. Page generated in 0.03597 seconds