Is any way to convert a java applet code to java script?
-
10Yes - 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 Answers
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

- 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
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.

- 2,942
- 22
- 27
-
You mean Java and ECMAScript are two entirely different technologies right...LOL – SkidRunner Feb 06 '17 at 12:58
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

- 54,350
- 12
- 131
- 107
No. Google Web Toolkit (GWT) is what you might need. I recommend book GWT In Practice 2008

- 18,367
- 27
- 104
- 155
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/

- 1,293
- 15
- 27