LogoDuyệtSr. Data Engineer
HomeAboutPhotosInsightsCV

Footer

Logo

Resources

  • Rust Tiếng Việt
  • /archives
  • /series
  • /tags
  • Status

me@duyet.net

  • About
  • LinkedIn
  • Resume
  • Projects

© 2026 duyet.net | Sr. Data Engineer

JavaPoly.js: chạy Java ngay trên trình duyệt Web

Note: This post is over 10 years old. The information may be outdated.

Polyfills native, hỗ trợ JVM, bạn có thể import file Jar, biên dịch và chạy trực tiếp mã Java ngay trên trình duyệt Web với JavaPoly, thư viện được viết bằng Javascript.

<!-- Include the Polyfill -->
<script src="https://www.javapoly.com/javapoly.js"></script>

<!-- Include your favorite Java libraries (jar files) -->
<script
  type="text/java"
  src="http://www.yourdomain.com/jimboxutilities.jar"
></script>

<!-- Write your Java code -->
<script type="text/java">
  package com.demo;
  import com.javapoly.dom.Window;

  public class Greeter
  {
    public static void sayHello(String name)
    {
      Window.alert("Hello " + name + ", from Java!");
    }
  }
</script>

<!-- Invoke your Java code from Javascript -->
<script type="text/javascript">
  com.demo.Greeter.sayHello('world')
</script>

Thấy hay vậy thôi, chứ hiệu năng và ứng dụng thì mình chưa nghĩ tới.

May 21, 2016·10 years ago
|Javascript|
Node.jsJavascriptJavascript Framework
|Edit|