Code Monkey home page Code Monkey logo

snaptea's Introduction

SnapTea

A SnapKit adapter to support running apps in the browser using TeaVM.

Check out this video demo of the Quickest way to Java in the Browser.

This project is a SnapKit adapter to use TeaVM to build SnapKit apps in JavaScript. To build SnapKit apps in SnapCode:

  • Clone this project in the SnapCode directory of your home directory
  • Create a new project and add SnapTea as a dependent project in project settings
  • Call snaptea.TV.set() in your main method (before anything else)

Then when you double-click on a .java file with a main method including TV.set(), it will:

  • Build a bin/tea directory in your bin directory with index.html, classes.js and runtime.js
  • Open the index.html in the platform browser

And that's it - You should see your Java desktop app in the browser!

snaptea's People

Contributors

reportmill avatar

Stargazers

Valentyn Berezin avatar  avatar Guillaume Legris avatar Y. Wang avatar  avatar Ajinkya Kulkarni avatar Ilya Shkuratov avatar Carlos López avatar Adrian Smith avatar Eran Medan avatar Matthias Nöbl avatar  avatar Jesse Pavel avatar  avatar

Watchers

James Cloos avatar  avatar Geoffrey (Wolfie) Wolf avatar

Forkers

jbwyatt4archive

snaptea's Issues

UnsatisfiedLinkError

I'm trying to set up a simple helloworld example to see how snapkit works using teavm to show the UI in the browser. This is the class I created as example:

public class App extends ViewOwner {

    static {
        System.setProperty("os.name", "TeaVM");
        snaptea.TV.set();
    }

    public View createUI()  { return new Label("Hello World"); }

    public static void main(String[] args) {
        //System.setProperty("os.name", "TeaVM");
        //TV.set();
        new App().setWindowVisible(true);
    }

}

And within gradle I have included the following dependcies for TeaVM:

    implementation group: 'org.teavm', name: 'teavm-cli', version: "$teavmVersion"
    implementation "org.teavm:teavm-classlib:$teavmVersion"
    implementation group: 'org.teavm', name: 'teavm-jso', version: "$teavmVersion"
    implementation group: 'org.teavm', name: 'teavm-jso-apis', version: "$teavmVersion"

When I start the main method I get the following exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 'org.teavm.jso.browser.Window org.teavm.jso.browser.Window.current()'
	at org.teavm.jso.browser.Window.current(Native Method)
	at org.teavm.jso.dom.html.HTMLDocument.current(HTMLDocument.java:55)
	at snaptea.TVViewEnv.getScriptRoots(TVViewEnv.java:125)
	at snaptea.TVViewEnv.getScriptRoot(TVViewEnv.java:149)
	at snaptea.TVViewEnv.set(TVViewEnv.java:180)
	at snaptea.TV.set(TV.java:223)

I'm running the application on a MAC1.

Any clue what could be wrong?

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.