Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Alan Bateman

On 10/09/2015 17:15, Mani Sarkar wrote:

Hi Rory,

I have played with the Jigsaw JDK using the Quick starter guide and 
have this to share with our community:

https://github.com/neomatrix369/jdk9-jigsaw

There is a small mistake in the example on Services (see my 
implementation you will spot it soon), also the Services example 
explains more than one concept at a time and I think this might just 
be a bit more than a simple example to illustrate Jigsaw features.


The last two examples are not fully fleshed out. I would put a 
footnote about jlink, that jmod + tools are going to supersede jimage 
(if from what I have read so far is correct, I have even seen this 
mentioned on a JBUG issue).


I don't immediately see the error in the services example (I need to 
look closer) but I think you have a point that this example jumps ahead 
too much. Good idea to get the examples into a repo with scripts.


Just on the tools then jlink + jmod don't supersede the jimage tool. 
Lots of new j- tools so the following might be helpful:


jlink is the linker. It links a set of modules together to create a 
run-time image, the layout of which is described in JEP 220. The jlink 
tool is in the current EA builds but no documentation to point at yet. 
There will be a JEP in time (as mentioned already in JEP 261). The jlink 
example you see in the quick start page should work and create a 
run-time image that contains module com.greetings and its transitive 
dependences. Another thing to mention is that the jigsaw/jake builds 
invoke jlink to create the JDK, JRE, and compact profile images. I think 
of jlink as a tool for the advanced tool chain and not something that 
most developers will use directly.


The jmod tool is to the JMOD format as the jar tool is to the JAR 
format. In the jigsaw/jake build then you'll see that the tool is used 
to create a JMOD for each standard and JDK-specific module. The 
directory of JMOD files then serves as the module path for the linker 
when it creates the JDK and JRE images. Like jlink then I don't expect 
too many developers to need to use the jmod tool or JMOD format as 
modular JAR files will do just fine for most modules. In the example in 
the quick start page then the only reason that the JDK jmods directory 
is on the module path is because creating a custom image requires 
resolving standard and maybe JDK modules so the tool needs to be able to 
locate the corresponding module artifacts.


Now jimage. In a run-time image (JEP 220) then classes and resources are 
stored in a container that is in jimage format. The format is 
deliberated not documented and best to assume it will change and evolve 
over time as it inhales new optimizations. Introducing a new container 
format is a bit scary and needs some tooling to aid troubleshooting in 
the event of problems. This is why the JDK 9 builds and the EA builds 
have a jimage tool. It can be used to do some verification, list or 
extract the contents. It's not meant to be on par with the jar tool of 
course. Instead just think of the jimage tool as First Aid Kit hanging 
on the wall in the event that you might need it.


-Alan.




Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Jim Connors

On 9/10/2015 4:30 PM, Alan Bateman wrote:
I don't immediately see the error in the services example (I need to 
look closer) but I think you have a point that this example jumps 
ahead too much. Good idea to get the examples into a repo with scripts.




In the Services Section: 
http://openjdk.java.net/projects/jigsaw/quick-start#services


$ cat src/com.greetings/com/greetings/Main.java
package com.greetings;

import com.socket.NetworkSocket;

public class Main {
public static void main(String[] args) {
NetworkSocket s = NetworkSocket.open();
}
}

When you run the com.greetings.Main class via:

$ java -mp mods -m com.greetings/com.greetings.Main

The Quick Start guide shows the output as:

class org.fastsocket.FastNetworkSocket

The Main.java file referenced above prints nothing (at least in my 
case), would it have to be modified slightly, something like:


$ cat src/com.greetings/com/greetings/Main.java
package com.greetings;

import com.socket.NetworkSocket;

public class Main {
public static void main(String[] args) {
NetworkSocket s = NetworkSocket.open();
System.out.println(s.getClass().toString());
   }
}

-- Jim C


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Jim Connors

On 9/10/2015 4:30 PM, Alan Bateman wrote:
I don't immediately see the error in the services example (I need to 
look closer) but I think you have a point that this example jumps 
ahead too much. Good idea to get the examples into a repo with scripts.




In the Services Section: 
http://openjdk.java.net/projects/jigsaw/quick-start#services


$ cat src/com.greetings/com/greetings/Main.java
package com.greetings;

import com.socket.NetworkSocket;

public class Main {
public static void main(String[] args) {
NetworkSocket s = NetworkSocket.open();
}
}

When you run the com.greetings.Main class via:

$ java -mp mods -m com.greetings/com.greetings.Main

The Quick Start guide shows the output as:

class org.fastsocket.FastNetworkSocket

The Main.java file referenced above prints nothing (at least in my 
case), would it have to be modified slightly, something like:


$ cat src/com.greetings/com/greetings/Main.java
package com.greetings;

import com.socket.NetworkSocket;

public class Main {
public static void main(String[] args) {
NetworkSocket s = NetworkSocket.open();
System.out.println(s.getClass().toString());
   }
}

-- Jim C


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Mani Sarkar
Jim you stole my thunder and lightening - that was it.

Cheers,
Mani

On Thu, Sep 10, 2015 at 9:55 PM, Jim Connors 
wrote:

> On 9/10/2015 4:30 PM, Alan Bateman wrote:
>
> I don't immediately see the error in the services example (I need to look
> closer) but I think you have a point that this example jumps ahead too
> much. Good idea to get the examples into a repo with scripts.
>
>
> In the Services Section:
> http://openjdk.java.net/projects/jigsaw/quick-start#services
>
> $ cat src/com.greetings/com/greetings/Main.java
> package com.greetings;
>
> import com.socket.NetworkSocket;
>
> public class Main {
> public static void main(String[] args) {
> NetworkSocket s = NetworkSocket.open();
> }
> }
>
> When you run the com.greetings.Main class via:
>
> $ java -mp mods -m com.greetings/com.greetings.Main
>
> The Quick Start guide shows the output as:
>
> class org.fastsocket.FastNetworkSocket
>
> The Main.java file referenced above prints nothing (at least in my case),
> would it have to be modified slightly, something like:
>
> $ cat src/com.greetings/com/greetings/Main.java
> package com.greetings;
>
> import com.socket.NetworkSocket;
>
> public class Main {
> public static void main(String[] args) {
> NetworkSocket s = NetworkSocket.open();
> System.out.println(s.getClass().toString());
>}
> }
>
> -- Jim C
>



-- 
@theNeomatrix369 *  |  **Blog
**  |  *LJC Associate & LJC Advocate
(@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project - *MutabilityDetector
*  |  **Bitbucket
* * |  **Github
* * |  **LinkedIn
*
*Come to Devoxx UK 2016:* http://www.devoxx.co.uk/

*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Mani Sarkar
Hi Alan,

Thanks for the detailed explanation and it would be great to find this in
your docs - I will link to it.

The reasons I understood, jimage might go away, as I read this https://bugs.
*openjdk*.java.net/browse/JDK-8049369.

But now its clear, they both have their place - I did think of jimage as
the runtime container - thanks for confirming

Cheers,
Mani


On Thu, Sep 10, 2015 at 9:52 PM, Jim Connors 
wrote:

> On 9/10/2015 4:30 PM, Alan Bateman wrote:
>
> I don't immediately see the error in the services example (I need to look
> closer) but I think you have a point that this example jumps ahead too
> much. Good idea to get the examples into a repo with scripts.
>
>
> In the Services Section:
> http://openjdk.java.net/projects/jigsaw/quick-start#services
>
> $ cat src/com.greetings/com/greetings/Main.java
> package com.greetings;
>
> import com.socket.NetworkSocket;
>
> public class Main {
> public static void main(String[] args) {
> NetworkSocket s = NetworkSocket.open();
> }
> }
>
> When you run the com.greetings.Main class via:
>
> $ java -mp mods -m com.greetings/com.greetings.Main
>
> The Quick Start guide shows the output as:
>
> class org.fastsocket.FastNetworkSocket
>
> The Main.java file referenced above prints nothing (at least in my case),
> would it have to be modified slightly, something like:
>
> $ cat src/com.greetings/com/greetings/Main.java
> package com.greetings;
>
> import com.socket.NetworkSocket;
>
> public class Main {
> public static void main(String[] args) {
> NetworkSocket s = NetworkSocket.open();
> System.out.println(s.getClass().toString());
>}
> }
>
> -- Jim C
>



-- 
@theNeomatrix369 *  |  **Blog
**  |  *LJC Associate & LJC Advocate
(@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project - *MutabilityDetector
*  |  **Bitbucket
* * |  **Github
* * |  **LinkedIn
*
*Come to Devoxx UK 2016:* http://www.devoxx.co.uk/

*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-10 Thread Mandy Chung



On 09/10/2015 01:55 PM, Jim Connors wrote:


When you run the com.greetings.Main class via:

$ java -mp mods -m com.greetings/com.greetings.Main

The Quick Start guide shows the output as:

class org.fastsocket.FastNetworkSocket

The Main.java file referenced above prints nothing (at least in my 
case), would it have to be modified slightly, something like:


$ cat src/com.greetings/com/greetings/Main.java
package com.greetings;

import com.socket.NetworkSocket;

public class Main {
public static void main(String[] args) {
NetworkSocket s = NetworkSocket.open();
System.out.println(s.getClass().toString());
   }
}



I think you are right.  The System.out.println is missing in the sample 
code in the quickstart guide.  The key point there is to show that the 
service provider implementation class is loaded.


Mandy

Mandy


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-11 Thread Alan Bateman


On 10/09/2015 22:21, Mani Sarkar wrote:

Hi Alan,

Thanks for the detailed explanation and it would be great to find this 
in your docs - I will link to it.


The reasons I understood, jimage might go away, as I read this 
https://bugs.*openjdk*.java.net/browse/JDK-8049369 
.


Yeah, it is confusing. That JBS issue tracked the creation of temporary 
image builder tool to use in JDK 9 until we had jlink. In jigsaw/jake 
then this image building tool has been removed and the build changed to 
create the run-time images with jlink. The Dependences section of JEP 
261 has a few words on this.


-Alan.


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-11 Thread Alan Bateman



On 10/09/2015 22:12, Mani Sarkar wrote:

Jim you stole my thunder and lightening - that was it.

Thanks Mani, thanks Jim, this is fixed on the QS page now. I've no doubt 
that in time that there will be much better examples and tutorials, that 
page is just a start.


-Alan


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-11 Thread Mani Sarkar
Looking forward to it - always a pleasure to help.

Cheers,
Mani

On Fri, Sep 11, 2015 at 11:35 AM, Alan Bateman 
wrote:

>
>
> On 10/09/2015 22:12, Mani Sarkar wrote:
>
>> Jim you stole my thunder and lightening - that was it.
>>
>> Thanks Mani, thanks Jim, this is fixed on the QS page now. I've no doubt
> that in time that there will be much better examples and tutorials, that
> page is just a start.
>
> -Alan
>



-- 
@theNeomatrix369 *  |  **Blog
**  |  *LJC Associate & LJC Advocate
(@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project - *MutabilityDetector
*  |  **Bitbucket
* * |  **Github
* * |  **LinkedIn
*
*Come to Devoxx UK 2016:* http://www.devoxx.co.uk/

*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-11 Thread Mani Sarkar
Hi all,

I have moved the jdk-jigsaw repo into the AdoptOpenJDK org, see
https://github.com/AdoptOpenJDK/jdk9-jigsaw

Cheers,
Mani

On Fri, Sep 11, 2015 at 11:12 PM, Mani Sarkar  wrote:

> Looking forward to it - always a pleasure to help.
>
> Cheers,
> Mani
>
> On Fri, Sep 11, 2015 at 11:35 AM, Alan Bateman 
> wrote:
>
>>
>>
>> On 10/09/2015 22:12, Mani Sarkar wrote:
>>
>>> Jim you stole my thunder and lightening - that was it.
>>>
>>> Thanks Mani, thanks Jim, this is fixed on the QS page now. I've no doubt
>> that in time that there will be much better examples and tutorials, that
>> page is just a start.
>>
>> -Alan
>>
>
>
>
> --
> @theNeomatrix369 *  |  **Blog
> **  |  *LJC Associate & LJC Advocate
> (@adoptopenjdk & @adoptajsr programs)
> *Meet-a-Project - *MutabilityDetector
> *  |  **Bitbucket
> * * |  **Github
> * * |  **LinkedIn
> *
> *Come to Devoxx UK 2016:* http://www.devoxx.co.uk/
>
> *Don't chase success, rather aim for "Excellence", and success will come
> chasing after you!*
>



-- 
@theNeomatrix369 *  |  **Blog
**  |  *LJC Associate & LJC Advocate
(@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project - *MutabilityDetector
*  |  **Bitbucket
* * |  **Github
* * |  **LinkedIn
*
*Come to Devoxx UK 2016:* http://www.devoxx.co.uk/

*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*


Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-14 Thread Alan Bateman



On 14/09/2015 17:48, Rahman USTA wrote:

|jlink  --modulepath  %JAVA_HOME%/jmods;mlib  --addmods  com.greetings  
--output  greetingsapp|
After last step, greetingsapp folder generated with all Jigsaw 
modules. How can I include just base mod or other compact mods ?


I assume what you are seeing is service binding with service providers 
and their dependencies getting linked into the image. Can you add 
"--limitmods com.greetings" to the command line and see if that gets you 
the run-time image that you expect?


If you run "greetingsapp/bin/java -listmods" then it will list the names 
of the modules in the generated image.


-Alan



Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-15 Thread Alan Bateman

On 14/09/2015 20:11, Rahman USTA wrote:
Yes with "--limitmods com.greetings" the result as I expected. So, why 
jlink links all modules without resolving over the root 
"org.greetings" module? When jlink links all modules?


The -limitmods option is limiting the set of observable modules to 
com.greetings and its transitive dependences. Very useful for testing 
and also important when using the linker.


There isn't a jlink JEP yet but I would expect the issue as to whether 
the tool does service binding by default or not be listed in its open 
options. In the current prototype then it always does service binding so 
this is why the resulting image has the service provider modules and 
their dependences.


-Alan


JaCoCo feedback - Re: Project Jigsaw: Early-Access Builds available on jdk9.java.net/jigsaw

2015-09-18 Thread Rory O'Donnell

Hi Evgeny,

Thanks for the feedback, glad to hear test suite is passing.

The additional size is expected during this testing/feedback period, 
builds include the JMOD files so that people can trying out the linker. 
They include the debug info files and finally bundles may not be 
compressed with the right options.


Rgds,Rory
On 17/09/2015 23:34, Evgeny Mandrikov wrote:

Hi Rory,

We can't add JDK9 EA Jigsaw to our automated build matrix, because it 
doesn't cache jdk downloads and I noticed that size of distribution is 
significantly bigger than size of JDK9 EA - 500 Mb versus 100 Mb. I'm 
going to implement caching for build system, but is this increase 
expected?


During manual testing there were some issues with Maven, but seems 
that Maven team already takes care of them, and I was able to 
workaround them. So that our build and test suite passes without 
problems.


However I think that more closer look on JEPs is required to check 
potential side-effects for our users. Marc, maybe you already thought 
about this?


Best regards

On Wed, Sep 9, 2015 at 7:25 PM, Rory O'Donnell 
mailto:rory.odonn...@oracle.com>> wrote:



Hi Evgeny,

Early-access builds of JDK 9 with Project Jigsaw are available for
download at jdk9.java.net/jigsaw .

The EA builds contain the latest prototype implementation of JSR
376 , the Java
Platform Module System,
as well as that of the JDK-specific APIs and tools described in
JEP 261 .

If you'd like to try out the EA builds, by far the most helpful
things you can do are:

 *

Try to run existing applications, without change, on these
builds to see whether the module system, or the modularization
of the platform, breaks your code or identifies code that
depends upon JDK-internal APIs or other unspecified aspects of
the platform.

 *

Experiment with the module system itself, perhaps by following
the quick start guide
, and
start thinking about how to migrate existing libraries and
application components to modules. We hope to publish some
specific migration tips shortly.

Please send usage questions and experience reports to the
jigsaw-dev
 list.
Specific suggestions about the design of the module system should
be sent to the JSR 376 Expert Group's comments list
.

For more information please seen Mark Reinhold's mail [1]

Rgds,Rory


[1]http://mail.openjdk.java.net/pipermail/jigsaw-dev/2015-September/004480.html

-- 
Rgds,Rory O'Donnell

Quality Engineering Manager
Oracle EMEA , Dublin, Ireland




--
Evgeny Mandrikov aka Godin 
http://twitter.com/_godin_


--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland