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)
Related
Can anyone tell me..while running servlets iam using apache tomcat. But everytime i make changes to my web application..I have to export the war file and put into the webapp directory again and again..it is too much time consuming and very hectic. For even small changes i have to export war file and then put in my webapp directory. I cant run my web application without doing this..i mean new changes are not reflected till then..
Isn't there any other method..i think auto deploy should do..and however it is set to true in my web application. but it is not doing it..I have been searching on the net since 2 days..but didn't got any solution..please help..
A WAR file is basically just a .zip with the respective webapp contents. Instead of deploying a WAR, you can deploy an "exploded WAR", being the contents of your webapp. Various build tools support doing this, for example, Maven supports the dir packaging in the assembly plugin. Then, you can for example configure your project to build classes directly to your WEB-INF/classes directory of your "exploded WAR".
EDIT: In case it wasn't clear - you just put the exploded WAR within a directory in the webapps directory where you normally put the WARs - so instead of application.war, you just put an application directory containing the webapp.
Most popular IDEs like Eclipse, IntelliJ or Netbeans provide web testing and publishing tools for users, it's a very basic feature.
In case you're using Eclipse, navigating to Web Tools Platform User Guide > Using the server tools in help page, should be sufficient for you to set up the environment.
Here's online help document for Eclipse Mars, for your convenience.
IDE
You can develop with IDEs like Eclipse or Netbeans. It will be easy to develop and auto-deploy will be taken care by themselves. It will save much time. And completely developed final product can be exported at final stage.
As mentioned, the IDEs nowadays can do some rapid redeployment or hot-swapping of classes. This can work for some scenarios but not all.
JRebel
For even more advanced hot-swapping in more scenarios, consider the commercial tool JRebel by ZeroTurnAround.com.
I might be barking up the wrong tree here as I have no experience with java programming.
I came across jsprit a java based VRP solver which looks very impressive and I was wondering if it can be used in a php based web app.
I have installed tomcat and JavaBridge, I have downloaded the jsprit source and binaries.
Is it possible...
to use the binaries directly by creating and deploying a .war file?
or
use the .jar files via JavaBridge?
or would I need some kind of java web app to act as a wrapper?
I have seen an app on github which looks to be a wrapper but it doesn't look finished or still active.
Thanks for any help...
After further research I found the anser myself.
I downloaded the JavaBridge template .war file and renamed it to jsprit.war.
I then downloaded the binaries for jsprit.
Using 7-zip I added the jsprit binaries to the newly renamed jsprit.war in the WEB-INF\lib folder.
Installed and setup tomcat.
Installed php5.cli.
Using tomcat web app manager I deployed the jsprit.war file.
Now, by including http://localhost:8080/JavaBridge/java/Java.inc in my php page I am now able to access the jsprit classes using: $location = new java('jsprit.core.problem.Location');
Hope this helps someone else in the future.
I need to work on an existing java servlet project (tomcat 7). it's the first time to me to work on an existing project that other developers worked on before.
What I have, are the .class files, configs (web.xml and and all the resources) on the server. I can access to them. but my client asked me to work on that files in order to solve bugs and to develop additional features.
I want to work with eclipse so that I can import .java classes files (through decompiler tools, I aready have) and perform those changes my client needs.
my question is:
once I re-create the environment (new eclipse dynamic project with the existing/[on server] file classes .java on my local pc), can I overwrite the .class files once compiled and tested in order to perform changes that my client needs (with tomcat restarted)?
do you have alternatives in order to proceed with developing new features/resolve bugs and deploy the project into the existing/running remote tomcat server without complications?
thanks in advance
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.
I earlier got to create a simple RESTful webservice on my localhost using Eclipse IDE, Tomcat, and JAX-RS libraries.
I am now trying to move the same on to a different unix server which has Tomcat installed. I am not knowing how to get started as in what is equivalent to creating a "Dynamic Web Project" that I do in Eclipse. Do I need to just create a directory myself with all the sub-directories as created by Eclipse? Should this directory be placed in webapps folder in Tomcat container. Should META-INF and WEB-INF also be created by myself?
Where should I put my Java classes?
Can somebody please clarify this or direct me to any documentation about the same.
You need to package your application in a WAR file.
The Sun Java EE 6 Tutorial has a chapter deciated to packaging.
It's pretty easy to export a web application as a war in Eclipse.
Dynamic Web Project (right click) => Export => Web =>war file =>war export dialog
Creation of web application archive - WAR is the solution for your problem,
but take care about all libraries that you need there.
You can easily extract (unzip) WAR file content
and check your project structure and libraries needed
and they will be in WAR's WEB-INF/lib.
Make sure that both Tomcats are set same way,
make sure your code is all OS friendly (users, file paths, permissions)
Always write some test simple code that will run up on app start,
and check all dependencies and libs, system clock, outside world network communication, so you can trace it in web app console or logger easily.
regards