Eclipse Web Project Name - java

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

Related

Where can i find to create new servlet file with intellij?

I'm new learner of JSP programming, so I choose intellij as my IDE.
I installed Intellij Ultimate, JDK14 from oracle,and Tomcat 9, and then searched for creating new project.
But, most of the posts which explain how to create a new servlet project says that
"when you create new project, you can find Web service checkbox under Additional Libraries and Frameworks in Java Pane."
Even JetBrains' are saying the same thing, (https://www.jetbrains.com/help/idea/preparing-to-develop-a-web-service.html), but I couldn't find it.
Of course I checked whether my plugins are enabled.
Anyway, I found another way to create it by selecting Java Enterprise, and after clicking Next, checking "Web profile" from Libraries and Frameworks.
But now, Another problem occurs because I cannot find "new - servlet project with right clicking on the src or src/main/java
Why are these things happening? Even if I find some way to create servlet file, maybe there will be other problems like this, I think.
Is there any prerequiste for JSP project? or is it just because intellij has been ungraded? I wanna know the reason why my intellij is different with others.
I found this way I hope it works for you as it did for me. First I would recommend you to add support for Maven framework or you just could download the JAR file of the needed dependency for creating and managing servlets Java Servlet API.
Adding Framework support for Maven
On the Project tool window, you have to select the module you want to add Maven Framework support to, right-click it and select Add Framework support. Just like this:
Adding Maven support
On the new window you just select Web Application and Maven from the list of available Frameworks. When selecting Web Application it creates a web package and its web.xml configuration file. When asked, accept creating the web.xml file to proceed. After these steps your project structure might look like this:
Project structure after adding Maven and Web application frameworks
Adding Java Servlet API dependency to pom.xml
Now you need to open the pom.xml file. This file helps you to add and manage your project dependencies as it allows you to retrieve them from the Apache Maven repository instead of downloading the JAR files and adding them manually to your project. You need to add the next dependency:
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
Your pom file should look like this after the previous step:
Adding Java Servlet API dependency
As final step, we need to open the Project Structure settings by pressing Ctrl + Alt + Shift + S or by navigating through File > Project Structure. Here we are going to find a Project Settings section on the left side of the window. We need to go to Facets and you may find a facet named Web. On the bottom of the window you should see an option called Source Roots. You have to enable it by clicking the checkbox, then click Apply and finally OK. You have to make sure that path shown in this section is indeed the path to your projects' src > main > java folder.
Marking folder as source root
Once you've done that, you should be able to go to any package in your project and create a servlet as follows: New > Servlet.
Creating servlet
Note: if you got a syntax error when pom.xml file was created the only thing you need to do is to change the <groupId></groupId> tag content to a fully qualified name you want your project to be identified by.
Given your project a qualified name
Note: I wasn't able to find a way to configure permanently the src > main > java folder as source root, so every time you close and reopen your project you need to go to Project Structure (Ctrl + Alt + Shift + S) > Facets > Web and mark it as source root again. If you find a way to do this permanently I would appreciate you to share your method.
More info on
Create a Maven Project with IntelliJ IDEA
Getting started with Web Service
right click src\java > Mark directory as > source root
go to File > Project Structure...
select Facets
click Web(project name)
check src\main\java under source root.
First, you can go to src > main > java, then right click:
and then New > Create New Servlet.

Use netbeans to create oracle Jet application: Project folder is already NetBeans project (maybe only in memory)

I can not create a O-Jet application because of "Project folder is already NetBeans project (maybe only in memory)." issue.
I have googled this issue and deleted nbproject folder and re-start netbeans, but when I create the application again it throws the same error.
The IDE version:Netbeans 8.1
You do not need to "create" a JET project with NetBeans. Just open it. NetBeans will automatically recognize the folder as a project because of the package.json file that is included (that indicates to NetBeans that it is a Node based project).
Finally I changed the name of the application because I usually use the default name. Although I have deleted the application with the same name, there maybe something remaining in memory which results in this issue.

Create duplicate web project in eclipse from WAR

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.

Eclipse & Tomcat: How to deploy a project to differently named directory

I am using Eclipse Juno. I'd like to know how, if possible, to deploy a workspace project ('Foo') to a folder under Tomcat called 'Bar'.
Some points to note:
Project name in eclipse: Foo
Folder that gets created when I publish: $TOMCAT/wtpwebapps/Foo
Folder that I wish to be created: $TOMCAT/wtpwebapps/Bar
I have set the 'Context Root' under 'Web Project Settings' to Bar
The project has the 'Dynamic Web Module' facet applied.
I am not asking about the way in which I would access this project via the webserver (ie., http://localhost:8080/Foo vs http://localhost:8080/Bar). I explicitly mean the name of the folder to which the content is deployed.
MyEclipse is able to do this. I don't want to use MyEclipse, so would love to know how to achieve this using the vanilla version.
Thanks in advance!
Open the project's Properties dialog (either from its context menu or the main Project menu with that project selected) and change the context root on the Web Project Settings page.
You can write a script which copy your /desired_folder to your desired_directory and call that script in your code at the end or somewhere in eclipse properties after compilation or execution.It may works fine

Java Web Project not building correctly

I've got a Java Web Project which I'm deploying to a Tomcat embedded in Eclipse's Servers Plugin, alas, when I navigate to the location of that webapp after publishing/starting the server, the .class files are all missing. I can navigate as far as ProjectName\WEB-INF\classes\path\to\packages\ -> All packages are empty.
Any Idea how to solve this problem?
Edit
Build Automatically is checked and it compiles just fine for another web project I've just included, just not for the one specified
Edit 2
Reinstalled Eclipse (because why not) - nothing's changed, works for Project #2, doesn't work for Project #1. Not even the path to the packages is existant now. The content of the src folder (that's supposed to be moved to WEB-INF/classes) isn't there at all - but the resources (I've got a resources folder with the same deployment assembly command) are.
A few steps to perform to restore sanity...
Refresh your project. It is possible that something was modified on the file system external to Eclipse.
Kick of Project -> Clean.
Now look at your project (not the deployed location) on the file system. Do you see the expected files in the /bin directory (or whatever you may have changed class output directory to)?
Let's now try exporting a war using the wizard. File -> Export -> Web -> WAR or something like that. Check the WAR contents. Are you .class files there?
If everything is good so far, there is nothing wrong with your project. The Tomcat server adapter just got confused.
In the Servers view... Make sure Tomcat is running. Next right click on Tomcat and select add/remove projects. Remove your project. Confirm that your web app is no longer accessible.
Now re-add your project via add/remove projects or invoke one of the run as actions.
The above should reset Tomcat server adapter and hopefully things should work as expected.
Check if you had deleted or moved your external JARs associated with the project on your IDE. I had moved it and ran into the same issue.

Categories

Resources