Code Monkey home page Code Monkey logo

j2cl's Introduction

Seamless Java in JavaScript applications that tightly optimizes with Closure


J2CL is a powerful, simple and lightweight transpiler from Java to Closure style JavaScript.

  • Get the best out of Java and JavaScript. You no longer need to choose between the two or lock into a specific framework or a language. Choose the right language at the right place and hire the best talent for the job.

  • Get it correct the first time. The robust run-time type checking based on the strong Java type system combined with the advanced cross language type checks catches your mistakes early on.

  • Provides massive code reuse. J2CL closely follows the Java language semantics. This reduces surprises, enables reuse across different platforms and brings most popular Java libraries into your toolkit including Guava, Dagger and AutoValue.

  • Modern, fresh and blazing fast. Powered by Bazel, J2CL provides a fast and modern development experience that will make you smile and keep you productive.

  • Road tested and trusted. J2CL is the underlying technology of the most advanced GSuite apps developed by Google including GMail, Inbox, Docs, Slides and Calendar.

Getting Started

Clone the repository and build a sample app from source:

  • Install Bazel.

  • Clone this repository:

      $ git clone https://github.com/google/j2cl.git
  • Build a sample app:
      $ cd j2cl/samples/helloworld
      $ bazel build src/main/java/com/google/j2cl/samples/helloworld:helloworld
  • Look at the optimized output:
      $ cat bazel-bin/src/main/java/com/google/j2cl/samples/helloworld/helloworld.js
      document.write('Hello from Java! and JS!');

Live-reload

ibazel is file-system watcher that auto-triggers bazel build when neeeded. To use it, just replace bazel with ibazel in any command:

  • Install ibazel and make sure it is in your path.

  • Run the development server

      $ cd j2cl/samples/helloworld
      $ ibazel run src/main/java/com/google/j2cl/samples/helloworld:helloworld_dev_server

You like build-on-save but you would like to refresh on your own terms? Pass -nolive_reload while running ibazel.

Setting up your first project

To start your first project, you can use the helloworld sample as a template:

      $ cp -R <j2cl-repo>/samples/helloworld <my-repo>/<app-name>

and you are done.

Guides

Get Support

Caveat Emptor

J2CL is production ready and actively used by many of Google's products, but the process of adapting workflows and tooling for the open-source version is not yet finalized and breaking changes will most likely be introduced. We are actively working on adapting more pieces including Junit4 emulation and faster pruning for an even better development experience. Stay tuned!

Contributing

Read how to contribute to J2CL.

Licensing

Please refer to the license file.

Disclaimers

J2CL is not an official Google product and is currently in 'alpha' release for developer preview.

j2cl's People

Contributors

rluble avatar gkdn avatar stalcup avatar tadeegan avatar dankurka avatar jdramaix avatar

Stargazers

Bogdan Petridean avatar

Watchers

Bogdan Petridean avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.