How to use the java.options function in java

To help you get started, we’ve selected a few java examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github koalanlp / nodejs-support / src / javainit.js View on Github external
export function initializer(conf) {
    let java = require('java');
    let mvn = require('node-java-maven');

    if(!Array.isArray(conf.javaOptions))
        conf.javaOptions = [conf.javaOptions];
    for(let i = 0; i < conf.javaOptions.length; i ++){
        java.options.push(conf.javaOptions[i]);
    }

    let fs = require('fs');
    let path = require('path');
    let os = require('os');

    let getUserHome = function() {
        return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
    };

    // Write dependencies as new package.json
    let dependencies = [];
    if(!Array.isArray(conf.packages))
        conf.packages = [conf.packages];
    for(let i = 0; i < conf.packages.length; i ++){
        dependencies.push(makeDependencyItem(conf.packages[i], conf.version))
github koalanlp / nodejs-support / lib / javainit.js View on Github external
function initializer(conf) {
    var java = require('java');
    var mvn = require('node-java-maven');

    if (!Array.isArray(conf.javaOptions)) conf.javaOptions = [conf.javaOptions];
    for (var i = 0; i < conf.javaOptions.length; i++) {
        java.options.push(conf.javaOptions[i]);
    }

    var fs = require('fs');
    var path = require('path');
    var os = require('os');

    var getUserHome = function getUserHome() {
        return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
    };

    // Write dependencies as new package.json
    var dependencies = [];
    if (!Array.isArray(conf.packages)) conf.packages = [conf.packages];
    for (var _i = 0; _i < conf.packages.length; _i++) {
        dependencies.push(makeDependencyItem(conf.packages[_i], conf.version));
    }
github inolen / gremlin-node / gremlin-node.js View on Github external
module.exports = function(opts) {

var java = require('java');

opts = opts || {};
opts.options = opts.options || [];
opts.classpath = opts.classpath || [];

//add default globbed lib/**/*.jar classpath
opts.classpath.push(path.join(__dirname, 'target', '**', '*.jar'));

//add options
java.options.push('-Djava.awt.headless=true');
for (var i = 0; i < opts.options.length; i++) {
    java.options.push(opts.options[i]);
}

//add jar files
for (var i = 0; i < opts.classpath.length; i++) {
    var pattern = opts.classpath[i];
    var filenames = glob.sync(pattern);
    for (var j = 0; j < filenames.length; j++) {
        java.classpath.push(filenames[j]);
    }
}

var GremlinGroovyScriptEngine = java.import('com.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine');
var GremlinPipeline = java.import('com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline');

var JSONResultConverter = java.import('com.tinkerpop.rexster.gremlin.converter.JSONResultConverter');
var JSONObject = java.import('org.json.JSONObject');
github hiteshjoshi / node-stanford-corenlp / lib / StanfordNLP.js View on Github external
var java = require('java');
var _ = require('lodash');
var semver = require('semver');

var xml2js = require('xml2js');

var util = require('./util');

java.options.push('-Xmx4g');

var getParsedTree = require('./getParsedTree');

var StanfordNLP = (function(userOptions) {

  function loadLibrary(path,version){
    
    if(semver.satisfies(version , '>=3.6.0')){
      java.classpath.push(path+"/slf4j-api.jar");
      java.classpath.push(path+"/slf4j-simple.jar");
    }

    java.classpath.push(path+"/ejml-0.23.jar");
    java.classpath.push(path+"/joda-time.jar");
    java.classpath.push(path+"/jollyday.jar");
    java.classpath.push(path+"/xom.jar");
github pedro-lucas / node-pdfbox / lib / java.js View on Github external
exports.getJavaInstance = function(options, classpaths) {
  if(!init) {
    init = true;
    java.options.push('-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider');
    java.options.push('-Djava.awt.headless=true');
    java.options.push('-Xmx1024m');

    options = typeof options === 'string' ? [options] : options;
    classpaths = typeof classpaths === 'string' ? [classpaths] : classpaths;

    if(Array.isArray(options)) {
      options.forEach(option => {
        java.options.push(option);
      });
    }

    java.classpath.push(path.resolve(__dirname, "..", "src-library/jai-imageio-core-1.3.1.jar"));
    java.classpath.push(path.resolve(__dirname, "..", "src-library/jai-imageio-jpeg2000-1.3.0.jar"));
    java.classpath.push(path.resolve(__dirname, "..", "src-library/levigo-jbig2-imageio-1.6.5.jar"));
    java.classpath.push(path.resolve(__dirname, "..", "src-library/pdfbox.jar")); //2.0.5
    java.classpath.push(path.resolve(__dirname, "..", "out/production/node-pdfbox"));
github whyjustin / magic-mirror-voice / magic-mirror-voice-bootstrap.js View on Github external
function _buildJVM() {
    process.env['VLC_PATH'] = config.client.vlcPath;
    process.env['VLC_PLUGIN_PATH'] = config.client.vlcPluginPath;

    java.options.push(
        '-Xbootclasspath/p:' + __dirname + '/java-client/target/dependency/alpn-boot-' +
        config.client.alpnVersion +
        '.jar');
    java.options.push('-Djna.library.path=' + config.client.vlcPath);
    java.options.push('-Xrs');

    if (config.debug) {
      java.options.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005');
    }

    const baseDir = __dirname + '/java-client/target/dependency';
    const dependencies = fs.readdirSync(baseDir);
    dependencies.forEach(function(dependency) {
      java.classpath.push(baseDir + "/" + dependency);
    });

    java.classpath.push(__dirname + '/java-client/target/classes');
  }
}
github ICIJ / node-tika / tika.js View on Github external
/**
 * @overview
 * @author Matthew Caruana Galizia 
 * @license MIT
 * @copyright Copyright (c) 2013 The Center for Public Integrity®
 */

/*jshint node:true*/

'use strict';

var java = require('java');

java.classpath.push(__dirname + '/jar/node-tika-1.13.jar');
java.options.push('-Djava.awt.headless=true');
java.options.push('-Xrs');

var NodeTika = java.import('org.icij.nodetika.NodeTika');

exports.extract = function(uri, options, cb) {
	if (arguments.length < 3) {
		cb = options;
		options = null;
	}

	exports.text(uri, options, function(err, text) {
		if (err) {
			return cb(err);
		}

		exports.meta(uri, options, function(err, meta) {
github ICIJ / node-tika / tika.js View on Github external
/**
 * @overview
 * @author Matthew Caruana Galizia 
 * @license MIT
 * @copyright Copyright (c) 2013 The Center for Public Integrity®
 */

/*jshint node:true*/

'use strict';

var java = require('java');

java.classpath.push(__dirname + '/jar/node-tika-1.13.jar');
java.options.push('-Djava.awt.headless=true');
java.options.push('-Xrs');

var NodeTika = java.import('org.icij.nodetika.NodeTika');

exports.extract = function(uri, options, cb) {
	if (arguments.length < 3) {
		cb = options;
		options = null;
	}

	exports.text(uri, options, function(err, text) {
		if (err) {
			return cb(err);
		}

		exports.meta(uri, options, function(err, meta) {
			cb(err, text, meta);
github hotpxl / corenlp-server / lib.js View on Github external
var setupGlobalOptions = function() {
  java.options.push('-Xmx4g');
  java.classpath.push('./java-lib/stanford-corenlp-3.5.2.jar');
  java.classpath.push('./java-lib/stanford-corenlp-3.5.2-models.jar');
  java.classpath.push('./java-lib/xom.jar');
};
github whyjustin / magic-mirror-voice / magic-mirror-voice-bootstrap.js View on Github external
function _buildJVM() {
    process.env['VLC_PATH'] = config.client.vlcPath;
    process.env['VLC_PLUGIN_PATH'] = config.client.vlcPluginPath;

    java.options.push(
        '-Xbootclasspath/p:' + __dirname + '/java-client/target/dependency/alpn-boot-' +
        config.client.alpnVersion +
        '.jar');
    java.options.push('-Djna.library.path=' + config.client.vlcPath);
    java.options.push('-Xrs');

    if (config.debug) {
      java.options.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005');
    }

    const baseDir = __dirname + '/java-client/target/dependency';
    const dependencies = fs.readdirSync(baseDir);
    dependencies.forEach(function(dependency) {
      java.classpath.push(baseDir + "/" + dependency);
    });