Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » ClassLoader question
ClassLoader question [message #66766] Sun, 08 June 2003 14:40 Go to next message
Roel De Meester is currently offline Roel De MeesterFriend
Messages: 15
Registered: July 2009
Junior Member
I have a java command line tool to Create a distributed class from a given
class
it is called by "java distribute com.company.pack.classA" which uses the
classpath to find all methods of this class and its superclasses to create
a DistClassA.java file..

I'm trying to convert this tool into a plugin, but i haven't been able to
retrieve the classLoader from the project where I selected the classA
compilation Unit.
Any Idea where to search?


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: ClassLoader question [message #68409 is a reply to message #66766] Mon, 09 June 2003 21:37 Go to previous messageGo to next message
Michael Taege is currently offline Michael TaegeFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

as far as I know you have to write your own class loader which extends
ClassLoader and overwrites the findClass - method (There's a good example in
a Sun Tutorial).
Inside the findClass-method you have to read the class file with a
FileInputStream and write the FileInputStream into a ByteArrayOutputStream.
Therefore you need a File-Object of the ICompilationUnit. This could be
obtained by

File classFile = myCompilationUnit.getResource().getLocation().toFile();

Regards

Michael


"Eclipse Newsgroup" <demeester_roel@yahoo.com> schrieb im Newsbeitrag
news:oprqgdp0vyvzj6u2@www.eclipse.org...
> I have a java command line tool to Create a distributed class from a given
> class
> it is called by "java distribute com.company.pack.classA" which uses the
> classpath to find all methods of this class and its superclasses to create
> a DistClassA.java file..
>
> I'm trying to convert this tool into a plugin, but i haven't been able to
> retrieve the classLoader from the project where I selected the classA
> compilation Unit.
> Any Idea where to search?
>
>
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: ClassLoader question [message #79497 is a reply to message #66766] Fri, 20 June 2003 19:34 Go to previous messageGo to next message
Roel De Meester is currently offline Roel De MeesterFriend
Messages: 15
Registered: July 2009
Junior Member
Actually I managed to do exactly that.

but my command was "java orbit com.company.pack.classA".

I have been able to do this, i'll put som more info about it tomorrow.

I've seen other people who needed a similar plugin, but in their case they
needed the ORB command.

Basically What you need to perform this command, is the Jar where this
'distribute' class is stored, and grab the classpath form the selected
workspace. The latter can be done by calling
JavaRuntime.GetxxxxClasspath(IJavaProject) . I don't remember the exact
line.

more info tomorrow.


On Sun, 08 Jun 2003 16:40:38 +0200, Eclipse Newsgroup
<demeester_roel@yahoo.com> wrote:

> I have a java command line tool to Create a distributed class from a
> given class
> it is called by "java distribute com.company.pack.classA" which uses the
> classpath to find all methods of this class and its superclasses to
> create a DistClassA.java file..
>
> I'm trying to convert this tool into a plugin, but i haven't been able to
> retrieve the classLoader from the project where I selected the classA
> compilation Unit.
> Any Idea where to search?
>
>



--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Re: ClassLoader question [message #79557 is a reply to message #66766] Fri, 20 June 2003 21:05 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

See

http://eclipsewiki.swiki.net/114#augmentedClasspath2

However, what you want to do, find all methods and super methods of a
class in a project using the classpath, is already provided for you by
JDT. There's no need to try to load the classes and use reflection to do
this.

Rich
Previous Topic:Custom Nature icon missing
Next Topic:Phantom Resources
Goto Forum:
  


Current Time: Sun Sep 08 04:21:48 GMT 2024

Powered by FUDForum. Page generated in 0.03994 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top