Setup Environment and Installation Guidelines
Contents
[
Hide
]
System Requirements
Aspose.Diagram for Node.js via Java is platform-independent API and can be used on any platform (Windows, Linux and MacOS) where Node.js and node-java bridge are installed. The machine must have Oracle JDK 7 or greater versions before setting up the installation.
Install from NPM
You can easily use Aspose.Diagram for Node.js via Java from NPM with the following command.
$ npm install aspose.diagram
If you encounter any problems during the installation process, please refer to https://www.npmjs.com/package/java.
Install from ZIP archive
To install and use Aspose.Diagram for Node.js via Java from a ZIP archive, follow the following instructions:
Linux:
- Download and install Node.js.
- Install Oracle JDK (1.7 or 1.8) for Linux, configure JAVA_HOME environment variable.
- Install python 2.x
- Install node-java bridge. You may run below commands @ terminal:
$ mkdir aspose.diagram.js.java
$ cd aspose.diagram.js.java
$ npm install java
- Download “Aspose.Diagram for Node.js via Java” and extract it into “aspose.diagram.js.java/node_modules”.
- Create a test file named hello.js using the following sample code in “aspose.diagram.js.java” folder:
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var newDiagram = new aspose.diagram.Diagram();
newDiagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
console.log("hello world");
- Now run “node hello.js” @command prompt to run it.
Windows:
- Install Oracle JDK8 and configure JAVA_HOME environment variable.
- Install Node.js and add node.exe to PATH.
- Install node-gyp.
- Install Windows Build Tools.
- Install node-java bridge and run below commands @ command prompt as an administrator:
> mkdir aspose.diagram.js.java
\> cd aspose.diagram.js.java
\> npm install -g node-gyp
\> npm install --global --production windows-build-tools
\> npm install java
- Download “Aspose.Diagram for Node.js via Java” and extract it into “aspose.diagram.js.java/node_modules”.
- Create a file named hello.js in “aspose.diagram.js.java” folder using the following sample code:
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var newDiagram = new aspose.diagram.Diagram();
newDiagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
console.log("hello world");
- Now run “node hello.js” @command prompt to run it.
Mac:
- Download and install Node.js (https://nodejs.org/en/download/)
- Install Oracle JDK 1.8 (recommended) for Mac, configure JAVA_HOME environment variable.
- Modify
JVMCapabilities section in “/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Info.plist” with root privilege. (“jdk1.8.0_152.jdk” depends on your jdk version), make it looks like following:
<key>JavaVM</key>
<dict>
<key>JVMCapabilities</key>
<array>
<string>JNI</string>
<string>BundledApp</string>
<string>CommandLine</string>
</array>
- Install python 2.x (if it is not installed).
- Install node-java bridge. You may run below commands @ terminal:
$ mkdir aspose.diagram.js.java
$ cd aspose.diagram.js.java
$ npm install java
- Download “Aspose.Diagram for Node.js via Java” and extract it into “aspose.diagram.js.java/node_modules”.
- Create a test file named hello.js using the following sample code in “aspose.diagram.js.java” folder:
var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var newDiagram = new aspose.diagram.Diagram();
newDiagram.save("output.vsdx", aspose.diagram.SaveFileFormat.VSDX);
console.log("hello world");
- Now run “node hello.js” @command prompt to run it.