Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Can I deploy a web application that contains non-java application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can I deploy a web application that contains non-java application?" Watch "Can I deploy a web application that contains non-java application?" New topic
Author

Can I deploy a web application that contains non-java application?

gao zhixin
Ranch Hand

Joined: Jan 18, 2006
Posts: 42
I have a application using swing, which contains some module that do not belong to java( c and unix shell), I have to change this application to java, and the cost should not too large. So can I first change the application to web, and then deploy it using a web container? If it can't, can I change it to applet ( the client using windows)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look into JNI (Java Native Interface) for calling your C code.
Look into Runtime.exec for calling your shell scripts.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html
[ August 15, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
gao zhixin
Ranch Hand

Joined: Jan 18, 2006
Posts: 42
Hey, buddy, I think you misunderstand my question, I can run that code in java application, but I want to change it to web...
Dave Robbins
Ranch Hand

Joined: Sep 16, 2003
Posts: 131
explain in more detail what you want to do

Dave
gao zhixin
Ranch Hand

Joined: Jan 18, 2006
Posts: 42
I want to move that application which using swing to web, but I don't know whether I can do that, because it has none java module
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

How can a Swing application have no Java?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
gao zhixin
Ranch Hand

Joined: Jan 18, 2006
Posts: 42
I mean , it has non-java module using JNI to access
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

It would be very difficult to port your Swing application to a web app, not because of any non-native code or JNI issues, but because your entire Swing layer would need to be jettisoned in favor of a new UI implemented using HTML pages.

Was the app written using a strict MVC pattern that would allow your model to work using a completely different presentation layer?

If not, you are looking at a re-write. if so, you are at least looking at implementing a new UI.

It might be a lot easier to go the Applet route, but I really don't know what would be involved there since I've never even seen the code for one, let alone written one.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can I deploy a web application that contains non-java application?
 
Similar Threads
How to run Web Application in ItellijIDEA
I am not sure how to change the view of url for struts 2
Reading from .txt file
How to deploy My JSP web application on Server
Can we keep style sheet outside the ear?