-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
If you're new to JMatrix project and want to build the project with different Java version, this page will help you get up and running quickly.
Rule Name | Description |
---|---|
help |
Prints the help message and list of rules. |
compile |
Compiles all the source files (.java ). |
package |
Creates the archived package of compiled classes. |
build-docs |
Generates the HTML pages of javadocs. |
usage |
Prints the tree representing example usages for build the project. |
check-verbose |
Checks whether the verbose status is ACTIVATED or DEACTIVATED . |
clean |
Cleans up the working directories thoroughly. |
cleanbin |
Cleans the compiled classes only. |
cleandocs |
Cleans the generated HTML documentation pages. |
Option Name | Description | Type | Default Value |
---|---|---|---|
FLAGS |
Append flags or options to specific rule ( |
string |
"" |
INCLUDE_SRC |
Whether to include the source files while packaging (Only for package rule). |
boolean |
false |
LINT |
Whether to invoke the linter during the compilation. | boolean |
false |
VERBOSE |
Whether to activate the verbose output for debugging (Only build-docs rule that supported verbose mode all , more details). |
boolean | string
|
false |
Profile Name | Description |
---|---|
include-src |
Includes the source files while packaging. |
lint |
Invokes the linter during the compilation and Javadoc generation. |
For list of Maven built-in commands, please refer to this website.
Before build the project, the first thing that need to do is clone the repository.
git clone https://github.com/mitsuki31/jmatrix.git
Important
Branch master
is always up-to-date but it looks dirty (some new features may unstable),
if you want stable version, use the latest version instead.
You can also check the latest release here.
make [options] [...] [arguments]
make [options] VERBOSE[=<bool>] INCLUDE_SRC[=<bool>]
-
Compile all the source files
make compile
All the source files are located in
"src/main/java/"
directory relative to project's root directory. And the generated class files typically will be stored in"target/classes/"
directory. -
Packaging and archiving all generated class files into JAR file
make package
Generated JAR file would be in
"target/"
directory. -
Clear all generated class files (Optional)
make cleanbin
This option is to clean
"target/classes/"
recursively only and will never remove the generated JAR file neither other directories.
Syntax:
export VERBOSE[=<boolean>] && make [options] [...] [arguments]
make [options] VERBOSE[=<bool>]
-
Activate
- Use
export
keyword
export VERBOSE=true
- Place it as arguments
make [options] VERBOSE=true
- Use
-
Deactivate
export VERBOSE=false VERBOSE=false
💡 Tips: You can use
VERBOSE=
to deactivate it, without usingexport
and specifyvalue
anymore. It because you have already exportVERBOSE
variable when you activate it, andMake
only checks value ofVERBOSE
variable when it's equivalents totrue
.
Syntax:
make [options] INCLUDE_SRC[=<bool>]
This option is useful to generate a JAR file containing all source files. When using this option the build system will generated two JAR files, they are:
-
jmatrix-<VERSION>.jar
(contains compiled source files.class
) -
jmatrix-<VERSION>-sources.jar
(contains uncompiled source files.java
)
make [options] INCLUDE_SRC=true
Note
This option was required only by package
rule, it will be ignored for other rules.
For example:
make package INCLUDE_SRC=true
You can also combine the Make's rules along with the options as long as you want. For example:
make check-verbose package cleanbin VERBOSE=true INCLUDE_SRC=true
- Compile all the source files
mvn compile
- Packaging and archiving all generated class files to JAR file
mvn package
- Install as Maven local repository (Optional)
mvn install
This option is useful to generate a JAR file containing all source files. When using this option the build system will generated two JAR files, they are:
-
jmatrix-<VERSION>.jar
(contains compiled source files.class
) -
jmatrix-<VERSION>-sources.jar
(contains uncompiled source files.java
)
mvn package -P include-src
It's very simple, the only need to do is:
- Compile the Program
Use
javac -cp jmatrix.jar MyProgram.java
-cp
or-classpath
switch to telljavac
to compile the program with specific path to class files or JAR file. - Run the Program
Use colon (
java -cp jmatrix.jar:. MyProgram
:
) after JAR file (or classes directory) name to telljava
to include specific directory when searching for class files.For Windows users, you might need to use semicolon (
;
) instead and enclosed it with double quotes.For example:
java -cp "<jar_file>;." MyProgram
Here's a detailed guide on how to use JAR file:
-
Create an example program
Let's assume that theMyProgram.java
file is located in"test/"
directory. But your current directory was in the parent directory of"test/"
directory along with the JAR file.. ├── test │ └── MyProgram.java └── jmatrix.jar
// MyProgram.java package test; import com.mitsuki.jmatrix.Matrix; public class MyProgram { public static void main(String[] args) { double[][] a = { {6, 7}, {1, 9}, {8, 0} }; Matrix m = new Matrix(a); m.prettyDisplay(); } }
-
Compile the program
javac -cp jmatrix.jar test/MyProgram.java
-
Run the program
-
UNIX
java -cp jmatrix.jar:test/ MyProgram
-
Windows
java -cp "jmatrix.jar;test\" MyProgram
In code above the
package test;
has been declared, so the correct way is using code below to run the program.-
UNIX
java -cp jmatrix.jar:. test.MyProgram
-
Windows
java -cp "jmatrix.jar;." test.MyProgram
The output from the example above will looks like this:
[1] [2] [1] 6.0 7.0 [2] 1.0 9.0 [3] 8.0 0.0
-
For any questions or feedback about this wiki, please reach out to the project maintainer(s) or create a new issue.
- Ryuu Mitsuki (Author)
This project is licensed under the Apache License 2.0. Please review the license file for more details.
- JMatrix v1.3.0 (Latest)
- JMatrix v1.2.0
- JMatrix v1.1.0
- JMatrix v1.0.0
- JMatrix v0.2.0 (Outdated)
- JMatrix v0.1.0 (Outdated)