Java Reference
In-Depth Information
In the
BuildAHouse
plugin, I had a bunch of code that you didn't see that actu-
ally did the house-building, and all you had to do was declare a few variables.
But now you're going to make
an entire plugin from scratch
, all by yourself.
To keep things a little on the simple side, at first you're just going to print
out some values. In fact, let's call this plugin
Simple
.
First you need to make a
Simple
directory for the new plugin, with a
src/
subdi-
rectory, a
src/simple
subdirectory, and with a
Canary.inf
,
Manifest.txt
, and
build.sh
,
just like we had in
HelloWorldEZ
.
I already provided a
Simple
directory for your reference down in
Desktop/code
,
but don't look at that unless you get stuck. You're going to make your
own
Simple
right under
Desktop
.
Since you might be doing this a lot, I've made a shell script named
mkplugin.sh
that will get you started.
In your
Desktop
directory, run the
mkplugin.sh
with the name of the plugin you
want to create, and it will make the directories underneath your current
directory and start you off with bare-bones Java code:
$
cd Desktop
$
code/mkplugin.sh Simple
$
cd Simple
$
ls
Canary.inf Manifest.txt bin build.sh dist src
$
cd src
$
ls
simple/
$
cd simple
$
ls
Simple.java
The file
Simple.java
lives up to its name; it doesn't actually
do
anything.
You'll be adding some code in between where it says
Put your code after this line
and
…and finish your code before this line
, as shown at the bottom of the following
listing.
Open this file (
Desktop/Simple/src/simple/Simple.java
) in your text editor and get ready
to type.