views:

15

answers:

2

Here's the issue:

I have three files in the same package: com.foobar

The directory to these files is:

C:..\mylibrary\src\com\foobar\

then inside I have foo.as and bar.as

When I try to run mxmlc C:..\mylibrary\src\com\foobar\foo.as I get the error:

A file found in a source-path must have the same package structure ' ', as the definition's package, 'com.foobar'.

To that I say: it does. The package is com.foobar. The structure goes ../com/foobar/foo.as

I've found a few other forum posts on the web about this error, and it seemed like the user had to make the directory matching the package name, which I already have. What am I missing?

Thanks in advance for any help you can give!

A: 

You've mentioned 3 different packages here: com.foo, com.foobar and com.plupload, and it sounds like you have one directory path for all 3: \com\foobar. If these classes are in the directory \com\foobar\ then they all need to declare the package as com.foobar. The package name and the directory path needs to match otherwise you will get the mismatch error you described. Bottom line: package names and directory paths are effectively synonymous.

Wade Mueller
Whoops, sorry with the slip up there. All three have the package declaration: package com.foobar and they all reside in the directory \com\foobar. I edited the original post to correct the errors.
John D.
Yikes. With those corrections I don't see anything wrong with your code. Sorry I can't help.
Wade Mueller
I guess I don't understand why it says the package structure is ' '. Shouldn't the error reflect the folders in which foo.as lies?
John D.
My guess is that it has to do with using mxmlc at the command line and that it is assuming that your package is actually the source root, hence it thinks the package is '' rather than 'com.foobar'. That's just a guess though.
Wade Mueller
A: 

A co-worker helped me for quite some time on this. Turns out I had to use the following command:

(in the directory x which holds \src\com\foobar\foo.as)

mxmlc -compiler.source-path=.\src -static-link-runtime-shared-libraries=true .\src\com\foobar\foo.as -output .\test.swf

For whatever reason, the -source-path command I tried wasn't satisfactory.

I'm not exactly sure why it works like this, but hey it works now. Hope this helps others that are lost trying to compile an actionscript package.

John D.