Inner Class's

G

gwoodhouse

Hello everyone,

Hopefully someone will have had this problem before (i can't beleive i
havnt come across this problem before).

I'm using a jar of a different project to reference certain objects/
methods/actions from it.

The problem im getting is that one of the source files in the jar has
an internal class within it. ie, when compiled it gives
"theclassname.class" and also "theclassname$1.class": When accessing
this from another project, it doesnt seem to be able to compile its
own "theclassname$1.class" -

To be honest, i dont even understand how it uses' jars without
compiling the source code inside.

Could anyone give me some expert knowledge in this area? My google
skills are again severley lacking when trying to find this stuff out.

Graeme
 
L

Lew

Hello everyone,

Hopefully someone will have had this problem before (i [sic] can't beleive i [sic]
havnt come across this problem before).

I'm using a jar of a different project to reference certain objects/
methods/actions from it.

The problem im getting is that one of the source files in the jar has
an internal class within it. ie, [sic] when compiled it gives
"theclassname.class" and also "theclassname$1.class": When accessing

That should be "TheClassName", by convention.
this from another project, it doesnt seem to be able to compile its
own "theclassname$1.class" -

To be honest, i dont even understand how it uses' jars without
compiling the source code inside.

JARs come with the code already compiled. They usually don't even have source
code inside them.
 
R

Roedy Green

When accessing
this from another project, it doesnt seem to be able to compile its
own "theclassname$1.class" -

What do you mean by this? The place where a class is defined compiles
into a class file that would have such a $1 name. In another class
that referenced the inner class, there would be no member of that
name, just a reference in the class file to that name.
 
J

Juha Laiho

I'm using a jar of a different project to reference certain objects/
methods/actions from it.

The problem im getting is that one of the source files in the jar has
an internal class within it. ie, when compiled it gives
"theclassname.class" and also "theclassname$1.class": When accessing
this from another project, it doesnt seem to be able to compile its
own "theclassname$1.class" -

To be honest, i dont even understand how it uses' jars without
compiling the source code inside.

Err... apparently then you've grabbed the source jar of the other project.
If that is the case, then _you_ should compile it first before using it.

Typically, I don't expect seeing any source code in jar files I'm using at
runtime (though I do know cases where the distribution jar of a piece of
software is built to include both the source and executable code, but
I'm not too fond of this practice.
 
G

gwoodhouse

Hello everyone,
Hopefully someone will have had this problem before (i [sic] can't beleive i [sic]
havnt come across this problem before).
I'm using a jar of a different project to reference certain objects/
methods/actions from it.
The problem im getting is that one of the source files in the jar has
an internal class within it. ie, [sic] when compiled it gives
"theclassname.class" and also "theclassname$1.class": When accessing

That should be "TheClassName", by convention.
this from another project, it doesnt seem to be able to compile its
own "theclassname$1.class" -
To be honest, i dont even understand how it uses' jars without
compiling the source code inside.

JARs come with the code already compiled. They usually don't even have source
code inside them.

Thanks again guys,

Was a silly mistake on my part by not checking the jar. It has
compiled with all the classes /except/ the inner classes. Why that is,
i have no idea but if i had to blame someone it would be eclipse! >:)

Graeme
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top