mounting a jar archive

L

Luca Ferrari

Hi all,
I've developed two classes (package1.class1 and
package1.subpackage.class2), compiled and put into a jar from the
command line (jar cvf package1.jar package1/). Now, using netbeans, I
can mount the jar seeing the code completion working fine, but when I
try to compile I get an error like: class class2 is public and should be
declared in a file named class2.
Classes are ok (public and declared in rightly named files), so I cannot
guess what is wrong.
Any idea?

Luca
 
A

Andy Fish

I've had this problem and I'm not sure exactly what caused it, but I think
it's related to having the source files and the jar file mounted at the same
time.

if you want to treat your jar file as an external component, unmount the
source directory; if you want the source to be part of your project, unmount
the JAR file.

maybe there is a way to do both (or maybe this is not exactly the problem)
but that's what worked for me.
 
L

Luca Ferrari

I've had this problem and I'm not sure exactly what caused it, but I think
it's related to having the source files and the jar file mounted at the same
time.

if you want to treat your jar file as an external component, unmount the
source directory; if you want the source to be part of your project, unmount
the JAR file.

maybe there is a way to do both (or maybe this is not exactly the problem)
but that's what worked for me.
 

I've tried to exclude the source when mounting the jar, but the problem
remains!
Any other idea?
 
A

Andy Fish

Luca Ferrari said:
I've tried to exclude the source when mounting the jar, but the problem
remains!
Any other idea?

hmm, make sure the jar file contains only the class files and not the
source.

Or you could fiddle around with the filesystem properties (use for compile,
use for debug etc) but I don't think that was what made any difference for
me.
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top