I want to open my web application which I made using Terminal/Text Editor on Linux into eclipse on windows.
I tried to open it by doing Import existing project but I don't see my servlet files i.e .java files in it and i also see error mark on my WEB.XML.
ty154 is my project name.
My Directory structure is
Tomcat -> Webapp->ty154
Ty154->Images & ->webinfo
Webinfo->classes
I have my JSP files in the ty154 folder and Images inside Image folder.
I have my .JAVA and .Class file inside Classes folder.
Please help me how to open and configure my project in eclipse.
Thanks in advance !!
Its not possible to import the project that you have created using terminal/text editor in to eclipse.You have to create a Dynamic Web Project under eclipse and copy paste the java files under source directory of the project. The jsp and other html files will go in to WebContents folder of the project. Once this is done the eclipse project can be copied and can be imported in to any other eclipse installations.The best read is:http://goo.gl/hPVapt
As you have written source code in terminal environment so you wouldn't be having an eclipse project file to be imported properly. First you need to create an eclipse project and then you can add source from your code directories. This link describes it pretty well:
http://thusithamabotuwana.wordpress.com/2011/06/15/importing-existing-source-code-into-eclipse/
If you have the war file, then you can import the war file directly in eclipse. Go to File>import then select war
For this you need to have Eclipse IDE for Java EE developers
The "Import Existing Project" entry only works for Eclipse projects.
In your situation with a simple project I would create a new Dynamic Web project and copy in the sources to the source folder - just Ctrl-c the files outside Eclipse, and Ctrl-v them inside Eclipse - and the static files to the publish location. You essentially need to know what has been done to ensure it has been done right.
Related
I am an absolute Java noob so please be kind. I moved to Java web development from PHP recently.
I have Java source code which contains looks like this:
src directory which has .java files
rsc directory which has hibernate xml files
log4jcnf configuration file for log4j
pom.xml file with libraries listed.
WebContent directory
build.xml & a javadoc.xml
Now I would like to export a war file and deploy it on a remote server.
How do I import the code into eclipse, and download the library files and eventually export a WAR file.
I understand these are very trivial questions, but all the resources online assume that the reader is a java developer.
What I have tried so far:
"Open projects from file system" - I locate the "Import Source" and Finish but nothing happens.
New "Dynamic Web project" - I uncheck "use default location" and select the location where my project files are and I get an error
"A project already exists on the file system at this location: /home/path/to/webservice. Either use "Import Existing Projects into Workspace" to create a project at this location or delete the contents of /home/path/to/webservice from the file system."
It might be good idea to read these short tutorials, in case you are new to Java Web Development as well as to Maven.
Maven for building Java applications - Tutorial
Using Maven within the Eclipse IDE - Tutorial
Introduction to Java Web development - Tutorial
Java web development with Eclipse WTP - Tutorial
I am trying to do the spring security tutorial at this link.
In the section entitled "Running the Tutorial application without Spring Security", I took the following steps (adjusted for differences between the current version and the version that was in use when the tutorial was written):
1.) I downloaded the latest release of the Spring Security Distribution,
2.) found and unzipped a war file in the dist directory called spring-security-samples-tutorial-3.1.2.RELEASE.war
3.) Renamed the resulting folder spring-security-tutorial
4.) Created a general project in eclipse called spring-security-tutorial
5.) Imported all of the contents of the unzipped spring-security-samples-tutorial-3.1.2.RELEASE.war
6.) Right clicked on the project in eclipse and selected configure...convert to maven project
7.) Then right clicked on the project and clicked run as...
But there was no "run on server" option. (I had chosen a general project instead of a Dynamic Web Project in hopes of preserving the file structure of the application to be imported)
I then started to repeat the process, but creating a Dynamic Web Project instead of a general project, and eclipse wants me to select the "src folders on build path". The file structure of the web application has 8 .class files in subfolders of WEB-INF, and I am not able to locate any .java files.
What steps can I take in order to download this and run it in eclipse on the server? With the ability to edit the classes?
I have read that I can select a .class file in eclipse and it will open the bytecode in the editor, so I imagine I can convert the class files to java files easily enough. But doing that within a general project triggers the error message that the class is not part of the classpath, so we need to get it in a working web project that can be run on the tomcat server from within eclipse first, I think.
A war file is a Web application ARchive (basically a zip). It is meant to contain a web application's compiled class files and resources (properties files, jsps, css, html, js, etc.). It a package that can be used by an application server (or servlet container) like Tomcat. Except through a Decompiler, you will not have access to the source code from the compiled .class files.
I doubt you can run this on Eclipse's Tomcat instances. Instead go to your Tomcat installation. Mine is at C:\apache-tomcat-7.0.22. Rename the war to something simple like security.war and place it inside the webapps folder, ie. C:\apache-tomcat-7.0.22\webapps\security.war. Go to C:\apache-tomcat-7.0.22\bin and execute the startup.bat Windows batch file. This script sets up the classpath and launches a Java application containing all the applications in webapps. You can see the startup logs in C:\apache-tomcat-7.0.22\logs\catalina.out (as you would normally in Eclipse console).
You can then go to localhost:8080/security to hit the application. Replace 8080 with whatever port you're configured on. security is the same name as the war file. When Tomcat starts (based on a config parameter) it will extract the war into a package directory under webapps with the same name.
You can play around with configuration settings. Some of the important ones are here.
You can shutdown Tomcat by running the C:\apache-tomcat-7.0.22\bin\shutdown.bat Batch file script. You'll have to do this and restart if you change something in the application (ex. the web.xml or a properties file).
I think the tutorial you linked was meant more for trying security settings than actually changing the source code. I'm sure there are other samples online for Spring security, I just don't know them.
I am a Beginner in Java GUI and am using Netbeans 7.3 to use Swing Components, the problem is that all was working fine, but one day when I Clicked Clean & Build and tested the JAR file, it was not executing, I ran it in the Netbeans and It is working fine.
Then I thought that it would be a problem of Build Properties so I compared build properties from a project which was working fine with Jar file but I cannot find any difference, The problem is that when I double-click the JAR file, no Error is shown, I tried many ways like executing it from cmd but It did'nt worked.
Can anyone help me out What could be missing, and one thing more that is I even tried to build my project on another computer through Netbeans but no use.
Try to open your .jar with winrar, and check if the classes are being added to the .jar, If they are not being added probably is a bug from netbeans, I would advise to install netbeans 7.2, and then open your project again, and then regenerate the Jar File. I was having a similar problem with Netbeans 7.3
I think you executing .jar file from different folder - not from where it was created? If so - that means your application can not find some files - pictures, etc. So if you have some files which application uses - create the folder named "lib" and place there your files - but not .jar file. For example:
File file = new File("/images/etc.png");
means that it is placed in lib/images directory. So your .jar file could be run from here:
C:/myTestApplications/myApp.jar
which contains also folder
C:/myTestApplications/lib/images
Try that.
I have a java based web application, which has certain java files and due to some need, i have added some jar files with in the project and made it project specific.
Now, While deploying them in production, I see, that the web file server (tomcat6) already has those jar files in its global library. Now, How do i remove reference of that jar file it, with out disturbing my code(which is working fine).
I saw in other article saying we just have to change the build path to refer the global library instead of local library.
Finally I have 2 questions.
How to do this?
If i'm working on windows and using path while configuring the build path, will it not be a problem if i deploy it in Unix environment.?
Please suggest. Also, its the problem with servlet-api.jar.
I use eclipse IDE. So how to perform these changes in eclipse?
Open your web project in eclipse and right click on the project. click on Properties and then choose build path and remove the jars you want to remove under the tab 'Libraries' and then export the war and deploy it in your tomcat6 server. if you want to run your web application in eclipse, you have to configure the server libraries by clicking 'Add Library' button in build path and then choose server runtime and choose the tomcat6 server configured in eclipse. Hope this helps
I just heard of library for reading/writing excel files without COM, so I figured I'd go check it out.
I downloaded jexcelapi_2_6_12.zip from this page http://sourceforge.net/projects/jexcelapi/files/ but I have no idea how to open it in Eclipse.
I know it's a silly question, but I'm sure it's not the first time someone's asked it, how do I open this in Eclipse in Windows, compile, run and debug it?
Primarily what you need from that zip is the jar which contains the library. You'll still need to actually write a Java app that uses it.
So what you need to do is:
Unzip the file you downloaded
create a new java project
add a lib directory to the project
copy jxl.jar from the zip into your projects lib directory
right click on the jar in eclipse and select "Build Path>Add to build path"
The classes in the library are now available to your project
Next create a new java file in your projects source folder and start coding.
Extract the zip file somewhere, put the jar file in your project's directory somewhere (e.g. under a lib directory) and then right-click on it and select "Add to build path" or something similar.
It's not runnable on its own though - you'll need to write some code in order to debug.
If you want to debug into the source code of the library itself, you'll need to tell Eclipse where the source is - but that's unlikely to be necessary.