File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes How to make a jar file of web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to make a jar file of web application" Watch "How to make a jar file of web application" New topic
Author

How to make a jar file of web application

ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
I have develop web application in JSP in JDeveloper. I can create war file but i want to create jar file using ant or JDeveloper. Can any body help me?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
No. Web apps are distributed as war files, not jar files. What are you trying to accomplish by packaging it as a jar file?
ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
Actually when i deploy war file, it consist of source code of jsp page. I want to deploy application without source code of jsp page.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
Why?
ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
simple to hide my logic and no one can take source code.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
How would anyone get access to the JSP files that are running on a server? Do you have reason to mistrust the server's system administrators?

Also, JSPs should not contain any business logic at all - that is part of the Java source code which is not part of the web app to begin with. The class files are part of the web app, or course, and they can be decompiled, but again - the attacker would have to have access to the server's file system.
ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
Actually the person who deployed that application had deployed it through jar file, he just compile the jsp page and make jar file of .class pages . Now i enhance some pages of in this old application in which jsp pages contain most of business logic, and i have to send new release. Hope you understand now.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42929
    
  68
I understand what you're trying to do - I'm just questioning the reasons for doing it, which seem not to be all that good.

Tomcat ships with an Ant task for pre-compiling JSP pages that you could use. Other servlet containers may have similar facilities.
ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
May be they did it because they didn't trust administrator. Can you tell me exactly how that could be done.
Shashank Ag
Ranch Hand

Joined: Dec 22, 2009
Posts: 88

Well as you said of JDeveloper, here is another perspective, are you using Oracle ADF in your project?
If so, an adf web project can be packed in a JAR which is entirely different case and what all other ranchers are saying here.

Basically, adf allows you to pack web project into a jar including jsp/jspx,images etc and refer these components within another web project after including this jar in it.


SCJP 91%, SCWCD 97%
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18989
    
    8

But of course once your supposed attacker has access to the server's file system, putting the application into a jar is worth exactly nothing. Once the attacker has the jar file, it takes just seconds to extract all of its contents.
ehsan ulhaq dar
Greenhorn

Joined: Jun 04, 2008
Posts: 19
No i don't use ADF, i just use simple jsp pages as i said the project i am working is old and i just enhance some feature on it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make a jar file of web application