java command:--module-path path or -p path
Specifies where to find application modules.
--module-path modulepath... or -p modulepath
A semicolon (;) separated list of directories in which each directory is a directory of modules.
henry leu wrote:Step #1: compile OK! modules-info.java & SimpleMathFuncs.java. (These files have no dependencies on module. So I don't use --module-path.)
javac -d appmodules\appfuncs
appsrc\appfuncs\modules-info.java
appsrc\appfuncs\appfuncs\simplefuncs\SimpleMathFuncs.java
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:
henry leu wrote:Step #1: compile OK! modules-info.java & SimpleMathFuncs.java. (These files have no dependencies on module. So I don't use --module-path.)
javac -d appmodules\appfuncs
appsrc\appfuncs\modules-info.java
appsrc\appfuncs\appfuncs\simplefuncs\SimpleMathFuncs.java
Is the exact command you ran? You have module-info.java in the file layout description in your post, but modules-info.java here.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jeanne Boyarsky wrote:I'm not sure, but I think it is because yo uare just compiling the first module and not jarring it up. So when you try to compile the second module, it doesn't match how the book presents it.
You can see the command to jar (and all commands used in the modules chapter of the book here)
henry leu wrote:But I thought Java also allows program to compile and run it in loose classes.
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
henry leu wrote:I still cannot resolved this problem.
Is this an example from your book? Anyway, it is possible to compile and run a modular project like Henry demonstrates. Here is a verifiable example:Jeanne Boyarsky wrote:In general does. I've never tried that with modules though hence my suspicion of that being the reason.
Without looking anything up, I suspect it isn't a module if it isn't a jar. Which makes sense because modules are supposed to be self contained. Unlike a non-modular program which can be one giant collection fo files on the file system.
All things are lawful, but not all things are profitable.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |