Application with mix of module and jars
Hamlin Li
huaming.li at oracle.com
Tue Jun 21 07:10:50 UTC 2016
Seems alias does not allow attachment, please check below for detailed
information.
[oracle at oraclelinux6 ModsTest]$ ls -aR
.:
. .. m1 NonModule run.sh
./m1:
. .. module-info.java pkg
./m1/pkg:
. .. ClassInM1.java
./NonModule:
. .. nonmodule
./NonModule/nonmodule:
. .. NonModuleClass.java
[oracle at oraclelinux6 ModsTest]$ cat run.sh
#!/bin/bash
rm -rf mlib
rm -rf jars
rm -rf mods
rm -rf classes
mkdir mlib
mkdir jars
javac -d mods/m1 m1/pkg/ClassInM1.java m1/module-info.java
jar --create --file=mlib/m1.jar --module-version=1.0 -C mods/m1 .
javac -addmods m1 -mp mlib -d classes/nonmodule
NonModule/nonmodule/NonModuleClass.java
jar --create --file=jars/nonmodule.jar
--main-class=nonmodule.NonModuleClass -C classes/nonmodule .
java -addmods m1 -mp mlib -classpath jars -jar jars/nonmodule.jar
java -addmods ALL-MODULE-PATH -mp mlib -classpath jars -jar
jars/nonmodule.jar
Thank you
-Hamlin
On 2016/6/21 14:59, Hamlin Li wrote:
> add attachment.
>
> Thank you
> -Hamlin
>
> On 2016/6/21 14:55, Hamlin Li wrote:
>> Hi Vishal,
>>
>> Something in your environment should be wrong. Attached sample test
>> passed with both -addmods m1 and -addmods ALL-MODULE-PATH
>>
>> Thank you
>> -Hamlin
>>
>> On 2016/6/21 7:06, vishal jain wrote:
>>> This works :
>>> java -mp mlib -addmods module2 -cp jars/nonmodule.jar
>>> nonmodule.NonModuleClass
>>> NonModule Say Hello
>>>
>>> Whereas this does not :
>>> java -modulepath mlib -addmods ALL-MODULE-PATH -cp jars/nonmodule.jar
>>> nonmodule.NonModuleClass
>>> Error: Main method not found in class nonmodule.NonModuleClass, please
>>> define the main method as:
>>> public static void main(String[] args)
>>>
>>>
>>>
>>> On Mon, Jun 20, 2016 at 1:51 PM, <mark.reinhold at oracle.com> wrote:
>>>
>>>> 2016/6/20 12:20:51 -0700, alan.bateman at oracle.com:
>>>>> ...
>>>>>
>>>>> If you add `-addmods module1` to the command line then I assume it
>>>>> will
>>>>> work. The reason you need this is because there isn't any module that
>>>>> has declared a dependency on "module1". The "Root modules" section in
>>>>> JEP 261 [1] has the details on the root modules to resolve at
>>>>> startup.
>>>>>
>>>>> -Alan
>>>>>
>>>>> [1] http://openjdk.java.net/jeps/261
>>>> Handy direct link: http://openjdk.java.net/jeps/261#Root-modules
>>>>
>>>> (URI fragment identifiers FTW!)
>>>>
>>>> - Mark
>>>>
>>>
>>>
>>
>
More information about the jigsaw-dev
mailing list