Yes you can, using the built in Java Applet
Please note that a lot of folks do not have Java enabled in their web browser.
I strongly advise against this. Java Applets are a huge security hole, not to mention the negative reputation they have. Much better just to go with LibGDX. Code everything in Java and deploy to HTML5/JS, Android, iOS, PC, Mac, Linux and who knows what else.