2

Is any way to convert a java applet code to java script?

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
Danny
  • 1,259
  • 11
  • 9
  • 10
    Yes - it is a technique known as "employing a programmer". :-) – Stephen C May 05 '10 at 07:26
  • Does this answer your question? [How to Cross-Compile Java Source Code to JavaScript?](https://stackoverflow.com/questions/440302/how-to-cross-compile-java-source-code-to-javascript) – Fritz Nov 28 '22 at 12:34

5 Answers5

2

Not really, no. They're different languages with different libraries.

If you want to develop for the client-side Web with Java, have a look at GWT

Matt
  • 43,482
  • 6
  • 101
  • 102
  • Most of the answers to this question are now several years out of date. A more recent list of Java -> JavaScript compilers can be found [here](http://stackoverflow.com/questions/440302/how-to-cross-compile-java-source-code-to-javascript). – Anderson Green Nov 19 '16 at 05:39
1

I don't think there is a good way to do so. Please remember: Java and JavaScript are two entirely different technologies. Don't mix them up.

Ham Vocke
  • 2,942
  • 22
  • 27
1

Not directly and without effort as far as I know. However people have ported many things to HTML/JS, like Quake 2 on GWT. So you could invest some time and step into the code and port it with GWT. Advantages of going with GWT arise from the fact that your applet is in Java language, which is the same language you use for GWT. Here is a list of what you can use in your code: GWT JRE Emulation

bakkal
  • 54,350
  • 12
  • 131
  • 107
1

No. Google Web Toolkit (GWT) is what you might need. I recommend book GWT In Practice 2008

Xorty
  • 18,367
  • 27
  • 104
  • 155
0

12 years later there is now a tool called "JSweet" which claims to do exactly that: converting Java code to JavaScript: https://www.jsweet.org/

There is also a blog post from 2019 of someone using JSweet to convert some Java Applets to JavaScript: https://www.lprp.fr/2019/08/jsweet-convert-applets-to-javascript/

Fritz
  • 1,293
  • 15
  • 27