ringojs java jar 集成使用
Posted rongfengliang-荣锋亮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ringojs java jar 集成使用相关的知识,希望对你有一定的参考价值。
ringojs 可以方便进行java 代码的集成,我们可以把下载的jar包放到classpath,后者ringojs 的lib 目录
也可以进行代码编写
测试代码
集成了java 的一个hashid 的jar 包 https://github.com/jiecao-fm/hashids-java ,下载地址可以使用maven
- 加载jar包(使用代码)
addToClasspath(module.resolve("./lib/hashids-1.0.3.jar"));
- 编写调用代码
addToClasspath 方式,使用stick 框架,完整代码参考 https://github.com/rongfengliang/ringojs-module-demo
app2.get("/id",function(request){
var hashids = new org.hashids.Hashids("this is my salt");
var hash = hashids.encode(java.marh);
return response.html(hash)
})
测试效果
ringo index.js
参考资料
https://github.com/rongfengliang/ringojs-module-demo
https://github.com/jiecao-fm/hashids-java
https://ringojs.org/documentation/java_integration/
以上是关于ringojs java jar 集成使用的主要内容,如果未能解决你的问题,请参考以下文章
ringojs 基于jvm 的javascript 平台试用
使用 ant 项目的 jenkins 集成在 svn 上生成 jar
Java:如何使用自定义 Ant build.xml 将 ProGuard 集成到 Jar 项目中