开发者

Can we use Tomcat Server in android app

开发者 https://www.devze.com 2023-01-22 09:54 出处:网络
I am developing Android Web App using JSP with xml parsing. I developed it in Java using Tomcat Server but I couldn\'t develop in Android. I am new to the web app development. So can anyone kindly sug

I am developing Android Web App using JSP with xml parsing. I developed it in Java using Tomcat Server but I couldn't develop in Android. I am new to the web app development. So can anyone kindly suggest me how to proceed further.开发者_开发知识库..

waiting for a response guys...Thank you


It is likely that you don't need tomcat on android. After all tomcat is (apart from everything else) a web server. This means that the phone your app is run within should be serving requests from other clients. I doubt you can make sure your phone IP is fixed, and even if that's the case, phones are not meant to be servers.

What I suspect you have done is - you've implemented some functionality in the context of JSP and servlets, but this functionality can easily be run without jsp/servlets. Remove the servlet-api.jar from your classpath and make your functionality work without these. Then you can easily use it in an android app.


While it should be possible from just the hardware standpoint, it should be nearly impossible to get tomcat running in the dalvik pseudo-java envrionment that android provides. the dalvik vm that Android uses is not a Standard Java VM, hence tomcat can't run on it.
I would suggest to look into the Maemo world, specifically the n800 and n810, which are a bit more hackish but also a lot more closer to linux than android. I've successfully run OSGI based apps on those machines. And they are still mobile devices you can use.

Check this site for some examples: http://wiki.maemo.org/OpenJDK_6.0_0_%28Cambridge_Software_Labs%29_on_N900


Look at i-Jetty. It's a web server that runs on the Android platform.


Why crazy? It is possible to make an ip pseudo-staic and then use a phone or tablet as a server instead of running a big power consumpting desktop 24/7. Of course for very simple purpos3 and probably as an experimental stuff. But not bad idea. I have written few years ago a tool for intarnal lan communication in the company which comprises synced and asanced messaging sastem, files and folders exchange functions, firewall solved access and everything in one jar cca 390 kb without any dependencies...there is also built in a http servlet and it runs on dalvik without problems - I have tested it. So the way is there, Even if the intention is not 100% clear.


You want to run Tomcat inside Android using dalvik? That is crazy. If it is a Web App host it somewhere and use the browser.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号