admin管理员组文章数量:1277901
I have a project I maintain in Java that runs primarily as an applet. I am finding that Applets are simply unpractical and dangerous for browser games as most end-users ignorantly trust any applet because it runs in the browser (this is also what gives applets such a terrible reputation.)
I want to pile my Java project to JavaScript and use HTML5 for rendering. There are a couple problems I can see with this though...
Would it be feasible to translate Java reflection to JavaScript? I use Java's ScriptEngine module to run scripts in the engine.
How scalable is this idea of piling to JavaScript. I have several pure Java dependencies that would also need to be pile to javascript (Specifically an Vorbis Audio SPI.) The code-base piles to ~300kb (not sure if that helps gauge the size)
What are some other likely restrictions to encounter with this process?
Thanks.
I have a project I maintain in Java that runs primarily as an applet. I am finding that Applets are simply unpractical and dangerous for browser games as most end-users ignorantly trust any applet because it runs in the browser (this is also what gives applets such a terrible reputation.)
I want to pile my Java project to JavaScript and use HTML5 for rendering. There are a couple problems I can see with this though...
Would it be feasible to translate Java reflection to JavaScript? I use Java's ScriptEngine module to run scripts in the engine.
How scalable is this idea of piling to JavaScript. I have several pure Java dependencies that would also need to be pile to javascript (Specifically an Vorbis Audio SPI.) The code-base piles to ~300kb (not sure if that helps gauge the size)
What are some other likely restrictions to encounter with this process?
Thanks.
Share Improve this question asked Sep 21, 2013 at 16:50 JeremyJeremy 8342 gold badges9 silver badges21 bronze badges 4- 4 While I'm sure someone has created a Java-to-JavaScript piler (which probably doesn't work too great anyway), you're much better off manually rewriting your project to JavaScript for the sake of maintainability. – FThompson Commented Sep 21, 2013 at 16:54
- Java is to JavaScript as car is to carpet. Of course it is feasible to port your code from Java to JavaScript, but it will not be as simple as porting to languages such as C# or Python. – azz Commented Sep 21, 2013 at 17:22
- 1 Porting the application to Javascript yourself takes perhaps 10 times as long as getting it to work in GWT. I would try GWT first and only do a manual port if the GWT port proves to be too slow. Best case you save 90% effort, worst case you do 10% more. – Matt Commented Sep 30, 2013 at 7:39
- possible duplicate of Any free tool to convert java to javascript – chappjc Commented Apr 18, 2014 at 0:37
2 Answers
Reset to default 5Hmm.. GWT piles java to JavaScript you can use it.
Another possibility would be using Rhino
Or just expose REST services and create an HTML5 web application using it.
Edit: BTW search in the forum. I found some questions like this one.
I found this tool called PlayN which may be what you're looking for. I've never used it before, but it looks promising. Of course, it may require rewriting your Java source to use their API, which means, as others have said, you're probably best off just manually porting to JavaScript.
本文标签: How feasible is it to convert a Java to JavaScript projectStack Overflow
版权声明:本文标题:How feasible is it to convert a Java to JavaScript project? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741301612a2371120.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论