字幕表 動画を再生する
-
[BELL DING]
-
Hello, and welcome to a new series
-
about building a processing library in Java.
-
So if you've ever wanted to learn a little more
-
about Java programming, and how Open Source works,
-
and how you can contribute your own code
-
as a library to some other platform,
-
this is the place for you.
-
I started working with processing in 2003, which
-
is some number of years ago.
-
It's too many years ago.
-
I can't possibly do that math.
-
And one of the things that I first
-
did when working with processing was contribute libraries to it.
-
And you can see here I'm scrolling
-
through the processing libraries page.
-
There are libraries for all sorts of categories.
-
I'm just going to go here under video and vision, for example.
-
And we'll see there's a library for using the PSI
-
camera for doing OpenCV.
-
Oh, look at this one for the connect.
-
And it's really not kept up to date.
-
There's a lot of wonderful libraries here, BlobDetection.
-
This is a really useful one.
-
I have some videos about doing BlobDetection processing
-
with your own code, but you could use a library for it.
-
So maybe you've used processing.
-
Maybe you've used a library before.
-
How would you make your own library?
-
This is what this video is about.
-
I have to admit something to you.
-
I have not actually done any research or practice
-
before I'm beginning this right now.
-
I have made processing libraries.
-
But I haven't really made one in a while.
-
So a lot of the series will also be me figuring it out as I go.
-
And hopefully everything works just fine.
-
It's somewhat of an ancient medieval art,
-
how to built a compilation of Java classes
-
to insert as a processing library.
-
And a lot of the stuff--
-
you noticed I've been doing Java scripts on the channel
-
these days.
-
But maybe after I do this I'll come back and show you
-
how to make your own JavaScript library as well.
-
So the very first thing that we need to do
-
is go to the processing library template under the processing
-
GitHub organization.
-
And you'll notice something.
-
It actually says template here.
-
And there's this little button here, Use This Template.
-
This is a new feature of GitHub.
-
I don't know how new it is.
-
Maybe it's been there for a while.
-
But I've actually never used this feature up
-
until right now.
-
A lot of times when you're using GitHub-- maybe
-
you're just trying to find some code,
-
and you're clicking around, you copy and paste it,
-
or maybe you're even ambitious enough to clone or download.
-
So cloning is a process of taking this repository
-
and cloning it, say, to another, to your local computer,
-
your laptop.
-
I'm actually going to do that a little bit later in this video.
-
Downloading would just be downloading the code.
-
There's this process of forking a repo, which
-
is kind of creating a version of it that is linked back
-
to the original version.
-
But this is a scenario.
-
This is a rare scenario where what I want to do
-
is build an entirely new project.
-
It's not really related to this.
-
It's related to this in that this is my starting point.
-
But there's no reason for what I want
-
to build to be a fork of the template
-
because I am not contributing back to the template.
-
If there was an issue with something
-
wrong in the template, then I would
-
want to make a fork to fix the thing that's in the template.
-
But I just want to start from it.
-
That was a very long explanation for me just basically pressing
-
this button.
-
So I'm going to press this button.
-
I'm actually going to switch this to coding train
-
because I would like this library that I
-
make to be a community project that people could submit to.
-
I could do that under Schiffman as well.
-
But this is a coding train processing library.
-
I'm going to call this open simplex noise library--
-
I'll call it for processing.
-
Let's call it for processing.
-
So that's going to be the name of the repository.
-
This is a new, a processing for open simplex noise.
-
And I want to make it public.
-
And I want to create the repository from the template.
-
I love this.
-
I love that this is a new repository, a new project.
-
But GitHub is being thoughtful about this
-
and crediting back where it was generated from.
-
Now, what is the next step?
-
The next step is now I want to work with this,
-
and update the code, and change it around, and put my stuff,
-
my open simplex noise stuff in it.
-
And by the way, you might be wondering
-
what is open simplex noise?
-
So I have a whole video about what that is.
-
It's not really important right now.
-
The point is how to make the library.
-
But I want to make it in the context that would be useful.
-
So I'll come back and talk more about open simplex noise.
-
And we'll look at some examples with it
-
as we get a little further along.
-
So I'm going to click Clone.
-
I'm going to copy this.
-
I' going to go to my terminal application.
-
I'm just in the desktop.
-
I'm going to say get clone.
-
And I'm going to clone this particular repo, which
-
will now download everything to my computer.
-
I'm just going to then open up that repo.
-
Oh, no I'm not.
-
I'm not.
-
I was about to open up that repo.
-
And I'm doing it right now in Visual Studio Code, which
-
would be fine, because then I could kind of look
-
at what's in there.
-
There's a hello library, job template and stuff.
-
But no, no, no.
-
Close all this.
-
This is not what I want.
-
This is a very momentous occasion.
-
This might be the first time I need to use a Java development
-
environment.
-
I'm sure there's some magical way
-
I could make Visual Studio Code do what it is I want to do.
-
But I want to do this with a Java development
-
environment, namely Eclipse.
-
This is the Eclipse foundation website
-
where you can download and install Eclipse.
-
And I'm going to do that in a moment.
-
I should mention also that a lot of people in the chat
-
are saying, oh, using IntelliJ.
-
I like that better than Eclipse.
-
I don't know.
-
Maybe it is better.
-
Maybe it's worse.
-
Who knows?
-
Who cares?
-
I'm just going to use Eclipse.
-
It's the only one I've ever used,
-
and I want to have at least one thing here that I
-
don't have to learn that's new.
-
But maybe I can come back and show IntelliJ at some point,
-
or one of you can make your own video
-
about doing the same thing with IntelliJ, and I can link to it.
-
Let's download Eclipse.
-
I'm going to get this most latest version.
-
I'm going to download the 64-bit.
-
This link looks good.
-
Eclipse, much like processing, is a non-for-profit foundation.
-
And you can donate.
-
All right, once you've downloaded it,
-
you're going to get this eclipse installer.
-
And then you've got to choose what you want here.
-
I want eclipse ID for Java developers, I think.
-
That's what I'm doing.
-
So I'm going to install it here.
-
Hit accept.
-
And here we go.
-
All right, I've downloaded, installed it.
-
I'm going to launch it now.
-
I also should mention that I think the processing library
-
template is designed for use with Eclipse.
-
It's creating a workspace, which is similar to a processing
-
sketchbook.
-
All right, here we go.
-
I have Eclipse now.
-
Now I'm going to have to do some work to fix the font sizes.
-
I realize if you're watching this
-
you can barely see anything.
-
But right now, I'll just use Zoom for a second.
-
These are my options.
-
I could create a new project, a java project,
-
a sort of general project.
-
But what I want to do, I am pretty sure,
-
is import a project.
-
So I'm going to click on Import.
-
And then these are all of my options.
-
Oh, look at this.
-
It even has a Git.
-
So I actually could probably import it from Git
-
but I think I can just do general existing.
-
This is what I want.
-
I think I want existing project into workspace
-
because the processing library template is an existing Eclipse
-
project.
-
So then I'm going to hit Next.
-
And I want to find that directory,
-
which is just on my desktop called Open Simplex
-
Noise For Processing.
-
I'm going to hit Open.
-
And you can see.
-
Look at that.
-
Oh, interesting.
-
It's called processing library template.
-
So there's probably somewhere that there's a name for it
-
that I might want to rename.
-
I'm going to worry about that too much right now.
-
I'm just going to click now Finish.
-
Finish.
-
And OK.
-
There we go.
-
This is looking promising.
-
Oh, I have a red x.
-
But you can see now this is an Eclipse project.
-
It's got all of the files here in this directory tree.
-
There's a data folder, an examples folder, a lib folder,
-
a resources folder.
-
I may have to get into what's in those things.
-
But the most important one right now is the source folder.
-
I'm going to click on that.
-
And we're going to see.
-
This is the Java file.
-
It's not a PDE file, not a processing development
-
environment file.
-
It's an actual proper Java file.
-
This is the file that I'm going to need to work with.
-
Let me quickly mention that under the Preferences,
-
under General Appearance, you can
-
change the theme to dark mode, which I'm doing right now.
-
PApplet cannot be resolved to a type.
-
The import processing cannot be resolved to a type.
-
So this is because this particular project
-
means as a dependency the processing core library itself.
-
So there are a couple different ways
-
that I could tell this project, my processing library,
-
about the processing core library.
-
And I'm going to show you the easiest
-
way to do that right now.
-
I should mention, however, that all of this, all of what
-
I'm awkwardly kind of stumbling through
-
is actually here as instructions on the read me.
-
And the step that I'm looking to do right now
-
is adding core dot jar or other jar files to your class path.
-
So the idea of a class path is a very important concept
-
in Java programming.
-
It is the path where all of your dependencies
-
live, all of the classes that your project depends
-
on live, the path to your classes, the class path.
-
So what I want to find is core dot jar.