Skip to content
← Back to Community
Graphics With Java in Replit
Profile icon
JasonSidell

I teach a high school computer programming class and we use Java. Is it possible to write graphical programs that run in the browser using Java in Replit?

In the past I have used Processing.org which makes it easy for beginners to visualize what they are learning with the code. We could do fun animations and simple games by drawing shapes and images on the screen, controling them with the keyboard, etc.

I know this is possible with other languages but I would like to stick with Java this year so I don't confuse them.

Answered by k9chelsea2 [earned 5 cycles]
View Answer
Voters
Profile icon
JasonSidell
Comments
hotnewtop
Profile icon
k9chelsea2

as prementioned im suire [Java Swing] (https://docs.oracle.com/javase/8/docs/technotes/guides/swing/index.html) would be a good option, if you go onto the new repl tab and pick a language, java swing should come up.

Profile icon
JasonSidell

@k9chelsea2 I think this will work! I'm trying to get it working but getting a weird bash error.
https://repl.it/@JasonSidell/JavaSwingPractice#Main.java

EDIT: Here's the solution to the bash error
https://repl.it/talk/ask/Java-Swing-BASH-Error-xset-command-not-found/117546

Profile icon
KyleTower1

You may use the StdDraw.java library by following this tutorial: https://www.youtube.com/watch?v=afv3lAJgsag

Profile icon
RYANTADIPARTHI

it is possible, but it's rare. You can use it with frontend. like HTML, css, and java.

Profile icon
19wintersp

Java is not generally used on the front-end of the Web [anymore].

If you're using it on Replit, you can use a library like Swing (which is intended for GUIs) or Java2D, both of which should work.