Tuesday, November 8, 2016

Java Package Manager (JPM)

Java package manager is managing libraries and application regardless platform. We can easily install application and libraries with help of JPM. Jpm4j is java implementation which use the power of java so that we can write once and deploy anywhere.

We can develop java libraries and application, publish in internet then notify to JPM4J so that we can deploy from anywhere in any platform with help of Jpm4j.

Install JPM4J in windows

We have two options to install JPM4J in windows

Using JPM4J JAR File
Using JPM4J Installer

Prerequisite:

Before install JPM4J we must install Java in our machine. If not please download JAVA from oracle then install in your machine. JDK 1.7 or JDK 1.8 is recommended.

Using JPM4J JAR File

You can use following download link to download JPM4J JAR file. Once you have downloaded then we can use java jar command to start JPM4J application.


You can Place downloaded JAR file in your desired location


Open command prompt and navigate to the directory where you have placed the JAR file.

Use following command JAVA JAR command.


java -jar biz.aQute.jpm.run.jar [options] init

We can pass following parameters

-u/--user: Install in the user's home directory (e.g. ~\.jpm\windows).

-g/--global: Install in c:\JPM4J, where c: is the system drive.


We can use –g so that it will be installed in C:\JPM4J directory.
Use following installation jar command in command prompt


java -jar biz.aQute.jpm.run.jar -g init




Once we run the above command then it will be created JPM4J directory and it consisted few sub directories.


Bin directory having all the commands which we can use to install java libraries and applications.

Now navigate to bin directory using command prompt then we can use all jpm4j commands.
Use following help command to see all available commands in JPM4J


jpm help





jpm install

The above command will be used to install other artifacts like java libraries and applications.

Example:

jpm install bnd

The above command will install bnd tools in our machine.


Liferay 7 need JPM4J to install BLADE CLI to develop Liferay 7 modules and applications. We will going through more details about BLADE CLI in the next articles.

The following command will install "BLADE CLI"


jpm install com.liferay.blade.cli


Setting PATH Environment variable for JPM4J

In the above case to run JPM4J commands we need to navigate JPM4J bin directory then have to use available commands.

To use these commands from anywhere from commands prompt then we have to set PATH environment variable for JPM4J bin directory.

Go to system properties


Click on Advanced System Setting then it will open window pop-up where we need to click on Environment Variables



Now select path variable and click on edit then add following JPM4J bin path at end of the string. Finally click on OK then JPM4J path will set as environment variable.


;C:\JPM4J\bin;



Once we completed the above steps, now we can run commands from anywhere and we don’t need to navigate to bin directory from command prompt.



Using JPM4J Installer

JPM4J is available as windows installer so that we can simply download and install .exe file as we generally doing in windows.

The following is Install Download link


Once you download installer just double click on file then follows steps to complete the installation. Once installation successful then it will create JPM4J directory. We need to set PATH environment variable for JPM4J then we can use all available commands from command prompt.

Reference Links

Author

Popular Posts

Recent Posts

Recent Posts Widget