You could create an entirely new backend for Tex that embeds a JVM or similar runtime environment. This JavaTeX would be a lot of work, and I guess you are talking about embedding Java applets in PDFs, instead, which can't be done. The resulting documents would be dangerous, since they could be artificially intelligent, and there would be no viewer support, so you would have to implement your own (a.k.a. Trojans).
You do not need any of these bad, dangerous things to create dynamic PDFs, since PDFs support layers that can be switched on and off interactively - this is called Interactive PDF, and there is some support for this in Context. There may also be support in Latex via a package.
You can create Interactive PDFs in Latex using the
insdljs package, which is part of Acrotex suite, and depends on the
Do note that relatively few PDF viewers support interactive features, and only Adobe Reader supports the whole of the PDF object model.