Giter Site home page Giter Site logo

adoptopenjdk / jdk9-jigsaw Goto Github PK

View Code? Open in Web Editor NEW
285.0 54.0 149.0 8.03 MB

Examples and exercises based on some of the features of jigsaw in JDK9/Jigsaw (Early Access builds)

License: Creative Commons Zero v1.0 Universal

Shell 29.05% Java 68.73% HTML 2.22%
java9 java jdk9 jigsaw modular modularisation jshell exercises challenge code-examples

jdk9-jigsaw's Introduction

jdk9-jigsaw

Ver la versión en Español (See Spanish version)

Examples of some of the features of Jigsaw released in the Early Access build of JDK9.

Many of the examples here are directly from the Project Jigsaw: Module System Quick-Start Guide, see http://openjdk.java.net/projects/jigsaw/quick-start but we have also contributions from the Java community.


Please note you are in the master branch which contains exercises which need to be solved by looking at documentation or resources provided in this repo. Hints may be provided within the source or script files. If you hit a roadblock and really want to see a possible solution you can switch to the exercise-solutions branch for that.

Looking at the solutions can take away the challenge behind solving the exercises. Stay on the master branch in case you would like to continue to have fun solving the exercises and working through the challenges.


Setup (all platforms)

See Download, install and verify JDK and return to this page to continue with the rest of the steps.

Download and install git or git-bash

  • Ensure you have a git client installed on your local machine/VM/vagrant box, for Windows users git-bash is recommended

Download and install the tree and wget command

See Download and install tree and wget and return to this page to continue with the rest of the steps.

Vagrant box

(Optional) Install JDK 9 compliant IDE

  • Install the latest IDE (IntelliJ, Eclipse, NetBeans - paid or community version) that supports JDK 9 EA, once installed configure the IDE to pickup the JDK 9 EA installed in the previous steps.

See Download, install and configure Eclipse Oxygen for JDK9.

Other preparations

  • Get familiar with the command-line a bit as we will be using much of it during the weekend

  • Prepare your VMs or cloud instances with the above, in case your local machine is not up for any installation or configurations

Note: the bash files provided should work on Linux and in theory on the MacOS as well.

Windows users
  • if you use git-bash (recommended) or cgywin should work for you - run the .sh scripts in one of the the environments. In the worst case scenario, we would have to manually convert the .sh files into .bat, with minor tweaks should also work there. Happy to receive a pull request for it. Or you could use bach, a platform independent Java Shell Builder. It's usage is explained in session-3-jshell.
  • check if the literal JDK path (or %JAVA_HOME%) has been added to the PATH environment variable or add it manually
  • ensure the JDK is installed in a folder where the name does not have a space in it
  • in case folder name looks something C:\Program files..., ensure that (name does not contain spaces):
    • the path to the JDK in JAVA_HOME has C:\Program~1 instead of C:\Program files...
    • the environment variable PATH refers to the JAVA_HOME environment variable
    • the environment variable CLASSPATH refers to the JAVA_HOME environment variable
  • in some instances jlink was not yet available when JDK is installed via the .exe file, even after the above path settings were applied (please verify beforehand)
MacOSX users
  • jlink is not yet available when JDK is installed via the .dmg file (please verify beforehand)

Exercises / examples covered

Please ensure you have verified that the necessary JDK programs work in your environment with the help of the Download, install and verify JDK resource.

Each example is enclosed in a folder of its own containing bash scripts to compile, package and run the respective examples. Use these scripts for each of the examples.

Community contributions

See guidelines on how to contribute.

License

See License document to find out about the licensing terms and conditions.

Resources

Must reads

Other resources


I need you for Java SE 9 development

jdk9-jigsaw's People

Contributors

amanica avatar antonarhipov avatar asafm avatar blalasaadri avatar codetojoy avatar danhaywood avatar enriquezrene avatar gunnarmorling avatar hendrikebbers avatar heysourabh avatar hillmerch avatar iweiss avatar kamkor avatar karianna avatar kwahsog avatar martinfmi avatar mcpringle avatar mureinik avatar narendranss avatar neomatrix369 avatar pegerto avatar practicalli-johnny avatar prasanthpadp avatar rachelcarmena avatar rgra avatar simonverhoeven avatar sjmaple avatar snyk-bot avatar sormuras avatar wjam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdk9-jigsaw's Issues

Issue (Session-2-jlink) in running ./link sh bash file.

Compile the 'hello world' example using:

$ ./compile.sh

Create JAR modules out of the class files:

$ ./packaging.sh

I am able to run above two scripts but getting issues while running below script.

Run jlink to produce a new run-time image (distributable JDK + your app) for the 'hello world' example:

$ ./link.sh 

Error- rahul_bhardwaj@AHM-LL-RahulBh:~/java9/jdk9-jigsaw/session-2-jlink/01_JLink$ ./link.sh

*** Removing any existing executable directories *** �

*** Create an executable version of the com.greetings module *** �
Error: Module java.base not found

Modified link.sh file -> `JAVA_HOME="C:\Program Files\Java\jdk-9.0.4"

set -eu

source ../../common-functions.sh

echo ""
echo "${info} *** Removing any existing executable directories *** ${normal}"
rm -rf executable

echo ""
echo "${info} *** Create an executable version of the com.greetings module *** ${normal}"
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] ; then
# Windows users: please not that if the below fails due to JAVA_HOME substitution, please hard-code the JAVA_HOME path into the script
jlink --module-path "${JAVA_HOME}\jmods;mlib"
--add-modules com.greetings,java.base
--output executable
else
jlink --module-path "${JAVA_HOME}/jmods:mlib"
--add-modules com.greetings,java.base
--output executable
fi

Check out documentation on jlink to survive at this stage

echo ""
echo "${info} *** Displaying the contents (modules) of the 'executable' folder *** ${normal}"
runTree executable

****************************************************************************************************************************

The value to --module-path is a PATH of directories containing the packaged modules.

Replace the path separator ':' with ';' on Microsoft Windows.

****************************************************************************************************************************`

Create separate get JDK binary scripts

Currently, we have getJigsawJDK.sh which download the JDK 9 EA binary from Oracle's site but it would be better to have one that download the JDK 9 EA binary and one that downloads the Jigsaw EA binary as they are served on two different download sites.

There is a difference in the binaries, that the Jigsaw binary always has the latest Jigsaw changes, while the Jigsaw changes in the JDK 9 EA binary may not always be up-to-date with Jigsaw changes.

Related to issue #63.

OpenJDK download via script not latest version - downloads 111 although 142 available

Using the getJigsawJDK.sh script a rather old version of Java SE Runtime appears to be quite old.

$ java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+111-2016-03-30-163859.javare.4768.nc)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+111-2016-03-30-163859.javare.4768.nc, mixed mode)

This version of the Java SE does seem to work with the compile.sh scripts without modifying the -modulepath variable.

Should we be using a newer Java SE version, as can be downloaded from the Oracle website?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.