npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

java-factory-lib

v0.1.32

Published

java 库包装器

Downloads

1

Readme

Java 库不能多次重复加载, 会导致进程崩溃

每个进程只有一个 java 实例, 在初始化之前保证路径已经加入到 java.classpath 中 factory 本身并不加载 java 库, 每个应用在初始化时首先初始化一个 java 并 传递给 factory, 深度嵌套的库本身使用 factory 来初始化自身

install

npm install java-factory-lib

如果 java 库没有安装, 则自动安装 java 库

usage

// java 已经被安装的情况下
var jfact = require('java-factory-lib');

// jar 路径, 亦可以通过这个方法引入 class 类目录
jfact.loadjar('../somedir/');

// 初始化路径
jfact.setJavaInstance(require('java'));

// 所有实用 java 库的部分都用这个方法获取实例
var java = jfact.getJavaInstance();

// 编译 src 目录中的 java 文件, 输出到 bin 目录
// 有错误会中断运行, 错误信息设置在 err 中
// 被编译的文件必须是 UTF8 编码
jfact.compile(src, bin, function(err, msg) {});

// 获取 classpath 字符串, 依赖之前通过 loadjar 加入的路径
// 当不含有路径时, 返回 null
jfact.getClassPath();