Compiling java code with non java extension file in eclipse - java

I am working on a project in which there are jsp files and some files with extension .jsps. And these files only include java snippets in form of <% %> and javascript code. And this .jsps file is included in jsp file. For compiling, eclipse is just ignoring .jsps files. And I want to compile all the files using eclipse version 3.4.1. Any idea will be appreciated. Thanks in advance...
Regards

What you should do is ask your app server to pre-compile all the JSPs. Each servlet/JSP engine will do it differently (e.g., WebLogic versus Tomcat), so you should be using the JSP compiler for the app server you're going to deploy to.
You can usually find Ant tasks to accomplish this. I don't think it's a job for Eclipse, unless you can find a plug-in for your app server.

Thanks for response. Actually, I solved the issue by using ANT through eclipse. And ANT file was already building the project, but outside of eclipse. Now, I used build.xml file in eclipse and it worked :)

Related

decompiler project run on tomcat

I have a java project which can run on tomcat and the project now have some problem which need me to fix. They give me a ROOT file to replace the root on tomcat to let the project run.I have all the .class file and I can decompiler to see them.But, how can I put these code into eclipse and run them as a web service? Jdk version:1.6.0.22 and Tomcat version:6.0.0.29
Actually you can do that. Create an eclipse Dynamic web Project, copy all the sources and paste to src folder project.
Go to the WEB-INF/lib of your app and copy all the jar files and paste to WebContent/WEB-INF/lib folder.
Verify the WEB-INF folder of your app because maybe there are jsp or html files in there, in case of that please copy all them an paste to WebContent/WEB-INF
Now the challenge will be the jdk version and tomcat version that are old, try to use the same versions on your development environment otherwise it will be kind of dificult to put the change to production environment.
Then try to run, it will throw a lot of errors, verify them and keep looking other dependencies maybe the configurations on web.xml, or server.xml. Sorry but its a very detail process, its not automatic.
Note: if you need only to change a .class file, then change it and compile it and just replace the .class file on production environment, avoid to replace the entire project, and remember, if you make any change on production please restart tomcat and verify log files, and again verify log files it will save a lot of time and effort.
Hope it helps.

Installing a game on Tomcat. Newb here

this might be a tall order or it might be ridiculously simple. I wanted to run this game on my website: https://github.com/ajanata/PretendYoureXyzzy
Unfortunately I have no clue how to make something like this work. There didn't seem to be an installation file, so I can only imagine it's painfully obvious to anyone familiar with this sort of thing. I recently ordered a trial of a shared Tomcat server, since I'm assuming that's needed to run all the Java goodies.
If there are any simple instructions I should follow to install this, it would be much appreciated if you could share them!
You need to download the source from the Github link you provided and then download Eclipse - Java EE. You then open Eclipse and choose File->Import->General->Existing Projects Into Workspace and choose the folder you just downloaded. You can then choose Export->Web->WAR file and export the WAR file.
You then download and setup Tomcat as described here (ignore the parts after Tomcat is running and you can access it at http://localhost:8080) and install the WAR as described here.
If you are feeling exceptionally lazy I have built the war here. You just need to drop it into the webapps folder in your Tomcat installation and then restart your server. You can then access it at:
http://localhost:8080/cah.
Hard to say without looking deeper into the project, if they create a .war file somehow, just copy the .war file into [tomcat home]/webapps directory and your application will be deployed. You can then acces it at yourmachine:8080/warname
where warname == the name of the war file without the .war extension.
There appears to be a SQL script with the project as well, not sure if there is some database you might need to setup which could get tricky.

Debugging Custom java WebApplication

I have IVR -Java application deployed on caucho Resin server
Web App is not in server but directory outside on same system. Also Jsp are getting compiled in external directory.
In eclipse I have source code when I launch debugger I am able to connect and I am able to debug through java classes but when control goes to jsp file it is not able to find source
Any idea how i can fix it.??
Maybe that's because eclipse can't find the source. Have you tried adding that to the build path? Project -> properties search for build path.
If the source requires a different language to run, Jsp (i've never dealt with that), then perhaps you can get a plugin for eclipse for that language (jsp) and then add the jsp source to a (eclipse) project that houses the jsp section of the whole project.
Edit: seems like since I haven't messed with JSP much, I gave the wrong advice. Follow the link in the comment below.

How to start development on existing java web application

I come from an Asp.Net development background and am very comfortable there. I was asked to support an existing Java Web Application w/ struts and am able to figure most of it out with my Asp.Net knowledge and my android development experience. However, I'm having a really simple but stupid problem.
All i have is the website as it exists on the server, no source project to work from. The folder on the server contains both .java and .class files, but the folder doesn't just import into netbeans as a recognized project.
What's the easiest way to get the site imported into some sort of IDE (I can work w/ eclipse too if netbeans isn't recommended), and get it to compile so I can deploy some updates.
It will not be easy to answer fully to your question here. But we should be able to achieve that by steps :)
Here i will speak for eclipse. But it is only because i'm not familiar with netbeans.
First of all create a clean "dynamic web project" under eclipse (using a J2EE enabled eclipse http://www.eclipse.org/downloads/).
Then :
copy your sources files in "Java Resources"
copy the rest of your application (without the class files) in WebContent
In order to test your application localy you will need a local server. Tomcat can be integrated easily in eclipse.
Usually you shouldn't have to (re)construct a project from a deployed web-app; the project should have been kept in version control. Source code isn't usually deployed to the server, either, but if it's been done in this case, you're in luck.
I would just make a new web project in NetBeans and manually move the .java files into it, along with the other resources (except for the .class files).
If you can use eclipse, and the source files are already in the war file as you say. You can import the war file directly into eclipse as project.
file -> import -> war file or existing project into workspce or filesystem (Several other options exists)

How to specify in Eclipse what to include in a .WAR file

In eclipse developing a java app, there are several class files that are generated by a custom ant script. This happens automatically, and it is set up as an export/publish dependency for /WEB-INF/classes.
With publishing it happens alright, however on exporting to .WAR these files just got missing.
Is there a way to automate this?
Go to the project properties you will export.
Setup the Java EE Module Dependencies
Now they should exist in your exported war.
I'd suggest generating your war file using Ant.
I like my deliverables to be easy to generate using a simple toolchain, i.e. not need to fire up Eclipse to generate them; this way things are easier to automate and document.
six years after edit: I was an Ant man when I wrote this- today I'd probably suggest Maven
Maybe you can try to add an extra builder. Go to project properties, and then "builders". You can add your own commands which will be run after the eclipse building process runs.
It's not an ideal solution, but maybe it works.

Categories

Resources