Moving on from Hello World to WorldClock, a simple multimodules application.
1. Get the source
Install Subversion:
sudo apt-get install subversionCreate the directories:
mkdir -p ~/dev/worldclockGet the source:
cd ~/dev/worldclockWhen prompted for guest password just press enter, Gnome keyring application then pops up, just cancel and say yes to store the password unencrypted.
svn checkout https://worldclock-application.dev.java.net/svn/worldclock-application/tags/application6-jigsaw ~/dev/worldclock/application --username guest
2. Move the source files arround
Create the additional directories:
mkdir -p ~/dev/worldclock/application/attic(attic is only used to store existing files that won't be needed)
mkdir -p ~/dev/worldclock/application/build
mkdir -p ~/dev/worldclock/application/resources/lh/worldclock
mkdir -p ~/dev/worldclock/application/src/lh.worldclock.application
mkdir -p ~/dev/worldclock/panel/build
mkdir -p ~/dev/worldclock/panel/resources/lh/worldclock/core
mkdir -p ~/dev/worldclock/panel/src/lh.worldclock.panel/lh/worldclock
Then move the files:
mv ~/dev/worldclock/application/*.* ~/dev/worldclock/application/atticThe tree should look like this:
mv ~/dev/worldclock/application/src/META-INF ~/dev/worldclock/application/attic
mv ~/dev/worldclock/application/src/lh ~/dev/worldclock/application/src/lh.worldclock.application
mv ~/dev/worldclock/application/src/lh.worldclock.application/lh/worldclock/core ~/dev/worldclock/panel/src/lh.worldclock.panel/lh/worldclock
mv ~/dev/worldclock/application/src/lh.worldclock.application/lh/worldclock/*.properties ~/dev/worldclock/application/resources/lh/worldclock
mv ~/dev/worldclock/application/src/lh.worldclock.application/lh/worldclock/*.png ~/dev/worldclock/application/resources/lh/worldclock
mv ~/dev/worldclock/panel/src/lh.worldclock.panel/lh/worldclock/core/*.jpg ~/dev/worldclock/panel/resources/lh/worldclock/core
So we now have 2 subprojects: application and panel
Each composed of 3 areas: build, src and resources
3. Add the Jigsaw layer
The first part is already there, the first level of subdirectories in the src directories represents the modules roots.
Next add the module-info file for lh.worldclock.panel:
( gedit ~/dev/worldclock/panel/src/lh.worldclock.panel/module-info.java & )
module lh.worldclock.panel @ 0.7And the module-info file for lh.worldclock.application:
{
requires jdk.desktop;
}
( gedit ~/dev/worldclock/application/src/lh.worldclock.application/module-info.java & )
module lh.worldclock.application @ 0.74. Create the library
{
requires jdk.desktop;
requires lh.worldclock.panel @ 0.7;
class lh.worldclock.WorldClock;
}
$JIG/bin/jmod create -L ~/dev/worldclock/modules5. Compile and add to the library
Panel:
cd ~/dev/worldclock/panelApplication:
$JIG/bin/javac -encoding UTF-8 -source 7 -d build src/lh.worldclock.panel/module-info.java src/lh.worldclock.panel/lh/worldclock/core/WorldClockBoard.java
$JIG/bin/jmod -L ~/dev/worldclock/modules install ~/dev/worldclock/panel/build -r ~/dev/worldclock/panel/resources lh.worldclock.panel
cd ~/dev/worldclock/application6. Run
$JIG/bin/javac -L ../modules -source 7 -d build src/lh.worldclock.application/module-info.java src/lh.worldclock.application/lh/*/*.java
$JIG/bin/jmod -L ~/dev/worldclock/modules install ~/dev/worldclock/application/build -r ~/dev/worldclock/application/resources lh.worldclock.application
$JIG/bin/java -L ~/dev/worldclock/modules -m lh.worldclock.application
No comments:
Post a Comment