tags:

views:

28

answers:

2

Can you extract source from tomcat application? The webapp is not deployed as a .war file, it's a bunch of directories, xmls, configurations, .class files, .jars and stuff.

+1  A: 

You don't have to put the source code on your web server, just the compiled class files. So no, if the source isn't on the server, nobody can "pick it up". In a normal configuration, I don't think it's possible even to download the individual class files, but it might be possible if you put your Tomcat webapps directory somewhere where your normal web server (Apache) can find them.

Paul Tomblin
Not exactly what I meant, I want to get that source myself (from my server which I have the access to). How would I go about that?
zladuric
What source? Like I said, there is not likely to be any source on the web server, except maybe the JSPs.
Paul Tomblin
Well, class files, xml files, jsps are all there... I just looked and found no .java files so I guess you're right, no source...So I guess the answer will be "no, you can't get the source", huh?
zladuric
That's what I said in my first and second sentence in the answer.
Paul Tomblin
+1  A: 

Your comments to Paul Tomblin indicate you already have access to the server. As he said, if you didn't upload the source to start with (which is normal), you can't get it off the server. However, there are a couple of things to note:

  • Unless you compiled your JSPs prior to uploading, they will contain their own source code and you can download them for use in another project or whatever it is you're trying to do
  • If you're desperate, you can decompile the .class files using something like JD (http://java.decompiler.free.fr). The decompiled code will not include comments and is not always spot-on, but it will get you much further than you are now.
spork
Well, this answers my question even further! Thanks, spork.
zladuric