Skip to content
Permalink
react4jdemo
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

React for Java Demo

Visit online version to get a taste for what this demo offers - e.g. using React.js and controlling it from Java.

Try it yourself!

Clone the repository and invoke gradlew to play with the demo yourself:

$ git clone --single-branch --branch react4jdemo https://github.com/jtulach/netbeans-html4j react4jdemo
$ cd react4jdemo
react4jdemo$ JAVA_HOME=/jdk-11 ./gradlew bck2brwsrShow

Modify the HTML files in src/main/webapp/pages/ and the Java files in src/main/java/ and repeat ./gradlew bck2brwsrShow to see the changes.

Debugging

It is possible to debug your application in JDK 11 HotSpot mode instead of running it in a browser. Rather than using bck2brwsrShow use:

react4jdemo$ JAVA_HOME=/jdk-11 ./gradlew run --debug-jvm --args index.html

and attach your IDE to port 5005. Then you can debug sources like src/main/java/cz/xelfi/demo/react4jdemo/LikeButton.java, place breakpoints into doLike methods, etc.

You can run the application without --args index.html - it is the default. But you can also use any other page listed in src/main/webapp/pages/. For example:

react4jdemo$ JAVA_HOME=/jdk-11 ./gradlew run --args ttt1.html

Launches the TicTacToe1.java component. Other possible arguments include ttt2.html, ttt3.html - see the switch in OnPageLoad for a full list.