Create duplicate web project in eclipse from WAR - java

I can't seem to get this to work. I have created a project using the standard method in Eclipse. I have another working project from which I created a WAR file. I want to create a duplicate project, so that I can style the UI differently from the other one and have the back-end work the same way as the previous project and compare.
I have tried this (importing from an archive file) method and this one (importing from a WAR file) and no cigar.
The second method gives me this error:
A project already exists with this name.
I am sure I am doing something wrong, but am at a loss as to what. Thanks for any ideas in the mean time.

I have tried importing from a WAR file option and it works perfectly. When you reach the following screen (see screenshot below), you have to give another name to the clone in the Web project: field and Eclipse will create a new project on workspace.

Related

How to call method/variable of one eclipse project to another eclipse project?

I have two Projects in eclipse and I simply tried to call method of one project to another but not able to do it even if I set up the whole flow of project setup using properties and even classpath.
I have project CacheProject which contains CachePackage as a package which has CacheMain.java class. This CacheMain class contains a public method getName() which should return me a value of one of the varible there as string.
I have also created jar for the respective CacheProject and added to classpath of another project CacheConsumer1. also I have added project CacheProject to Right click on CacheConsumer1 -> properties -> java build path -> projects.
Still I am neither able to access CacheMain nor getName() method of it:
also I am not able to access anything from the CachePackage:
Please help with it guys if anybody has already worked with something like this. Because none of the earlier answer posted in this stackOverFlow post is working for my scenario.
Actually everything would be easier if you would learn to use Maven or Gradle in order to build your projects and define dependencies. But in Eclipse you can just open both projects, then go to the project properties of project CacheConsumer1 and set project CacheProject as a build path dependency:
This will also lead to CacheConsumer1 automatically being rebuilt as soon as there are changes in CacheProject.
Update: I just noticed in your screenshot that CacheProject has no src folder or any other folder marked as source folder (the folder icon with the little parcel in it). Maybe you just start over, create a new Java project with default Eclipse folder structure and move the class or classes over to that project, creating your Java packages and classes inside the src folder.

Moving downloaded file to project in Eclipse

So from what I understand all classes need to be within a Java project in order to run them. However, when I just downloaded a Java class it automatically opened up in Eclipse outside of a project. Because of this I also cannot simply move it, as Refactor->Move gives the error "the resource is not on a build path of a Java project". So basically because it is not in a project, I cannot move it into a project? Is there a way to overcome this without just copying the class contents into a newly created class?
Edit: also I did not have this problem until a few days ago, when I moved the Eclipse application from a random folder in which it was previously installed, to the program files folder. If anyone could shed a light on why this might have triggered it, and why this predicament was not happening before this would also be appreciated.

Error with Spring locating classes using STS eclipse, what am I doing wrong?

I'm new to Spring framework. I'm working on this web service tutorial, but I'm having some problems.
Take a look at the project structure below:
At first, while I was following the tutorial I created new classes in the bookmarks package, since that's where the Application file was located. However, when I did this then I couldn't import a lot of the packages required for the tutorial. I spent some time trying to figure out if I'd missed something in the project settings, or there was an error in Gradle or something (another thing I haven't used before) but I couldn't find any issues.
I noticed if I moved the files concerned to the folder src/main then all the imports could be found without any issues.
So I carried on with the tutorial; however, when ever I tried to add a new file to the src/main folder, buy right-clicking it, selecting new java file, etc... eclipse always puts the file in the src/main/java folder and again imports cannot be found.
So again, I manually move the files to src/main.
The File WebServiceDemo3Application.java was auto-generated by the project, so that has to be in the correct location.
But after adding code to it, it cannot locate the files Account.java, Bookmark.java, etc...
It must be something silly that I'm overlooking, can anyone help?

Eclipse Web Project Name

I have 2 web projects and 2 framework projects in my Eclipse workspace. I copied one project to another and changed names in the .project file. All code and JSP pages compile fine. When I go to the Add/Remove dialog of my Tomcat eclipse server the new web project shows up named properlyy but in parenthesis it has the original project name. This is true of the new framework project also. Does anyone know where I need to change the name.
Found it.
.settings\org.eclipse.wst.common.component

Eclipse Hell . . . Failed to read the project description file (.project)

I think Eclipse is trying to make me miserable. A couple of hours ago, my project was working and compiling well. Suddenly that all changed. Eclipse somehow wipes out all changes I have made to my files(activity, manifest etc.) I make sure to save often but when I go to run the project, I get the error that I have a build error. I checked and there was none, so I go to close Eclipse, so I can reopen and see if the errors will go away. Instead what happens is Eclipse wipes clean all my files and I end up with a project on disk with lots of blank code files. I try to run anyway, and I get the error message below.
Failed to read the project description file (.project) for 'com.example.android.nfc.simulator.FakeTagsActivity.FakeTagsActivity'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.
Anyone have an idea what in the world this is about and how I can rectify this?
I would recommend to wipe out all the eclipse related configuration files(make sure you take the backup if you have manually made some changes in those) and import the project again, by following
File -> Import... -> Existing Project into Workspace
Make sure you take the backup of whole project before doing this.
When Eclipse gets stuck in some obscure status, I usually find useful to recreate the .metadata folder in workspace directory. It is a drastic solution, but it usually works for me. After that you can reimport all your projects.
This happened to me because I had a conflict in my .project file. I opened it up in a text editor and fixed the conflict (in my case, removed from ====... to >>>branch..., as well as <<<HEAD) and then I was able to open the project in eclipse.
I was just encountering this same issue (using Zend Studio 12, which is built on Eclipse). My problem was that I was creating a project from a Remote Server, and I was just downloading everything, which also included the .project file from the old project. It wasn't showing this error until I'd closed the program and tried to open it again (which usually wasn't until the next day).
I seem to have resolved it by making sure not to download the .project when initializing the project.
If the .project file is a text file, so if you have it in version control you might want to copy it over from there.
Before you trying the following make a backup of your current project state.
Assuming you don't have an old copy, you can open it in a text editor and try to see if there is something obvious wrong.
If this fails, copy the source files of your project to a fresh location (without the eclipse configuration files) and import it as a new project into eclipse.
if you still have all of your other source (.java files, AndroidManifest.xml, resources), you might be able to get your project back by simply going to the folder containing the project, removing the .project file that you say is now empty, and then using the new project wizard to recreate the project (and .project file) for you from your existing tree of source.
from the menus, select File -> New... -> Project , and then, in the first dialog, choose Android Project from Existing Code .
if you had done anything special to the .project (reliance on specific .jar files or changes to classpath), you may have to re-do these steps after you re-create your project; but at least it should pick up the code you already have.
If all the files are empty, and you have no working Backup, I can't help. I would recommend to use proper version control in the future.
Use git or mercurial, they have nice UI integrations (see tortoisegit/tortoisehg).
To decouple the build process and library management from eclipse, take a look at maven or gradle, this might help you in future projects.
If you use git, complete the merge e.g. del the head in your androidmanifest.
I also got the Same Issue in Eclipse but the real problem is i removed the actual Source project folder from source location (from which eclipse is trying to take the project) to some other place hence my eclipse is unable to get web.xml file since it is not available. Now i changed my source project folder location to the path where eclipse is trying to search for. Issue Resolved for me.
Just delete the 'servers' folder in your workspace and try again.

Categories

Resources