I'm new to learning Java web applications and tomcat, and am having a slight problem setting up eclipse if someone doesn't mind having a brief look please. A search came up with a few fixes
You didn't create your project as "Dynamic Web Project", so Eclipse doesn't recognize it like web project. Create new "Dynamic Web Project" or go to Properties -> Projects Facets and check Dynamic Web Module
-
right click on project name in Package Explorer view.
select Properties
Select Project Facets
Click on Runtimes tab
check server
Click on OK
And now :
right click on server name in Servers view
click on Add and Remove ...
move resources to the right column
From my limited knowledge it looks like I've done what has been asked here. The project was also initially set up as a Dynamic Web Project:
The book I'm studying for also says that I should change the selected server in the project properties menu, as is suggested about, but I don't see the option:
Am I missing something obvious? Or did I make a mistake when applying this patch for tomcat 8.5? (described here)
Any help would be much appreciated. Thanks
*edit: RE the response asking for me to be more specific - I'm trying to use Tomcat with a new project. I've managed it in Netbeans before, but the book I'm working from has samples using Eclipse, and I'm just trying to make things easier for myself in the future.
Here's the section from the book that I'm following. (I've already gone Windows>Preferences>Server>RuntimeEnvironment>Add and added Tomcat v8.5 that I had to patch in).
Related
hope you having a good day.
I am a java developer and currently learning servlets. I have downloaded a html template from colorlib and its hosted on my github. That template contains javascript, html, bootstrap etc.
To handle registration and other work I want to use servlets. I tried to import project in Eclipse(Java EE edition).
Steps I did are
Went to File>Import>Project from GIT (not smart import, just simple one).
Then I choose clone URI, entered the required details like URI, repository path, authentication details etc
Now in new Window its asking me to choose a project, now I want guidance for futher steps.
Which project type should I choose?
After choosing project type what name should I put inside project name as I am entering any name I am getting an error
Error connecting project project_name, no Git repositories found
Thanks in advance!!
P.S The server I am using is Tomcat 8.5 on localhost.
Import project using smart git import.
Step-1
Open your Java Project.
Step-2
Right Click on Your project -> Properties
Step-3
Click on “Project Facets” from left menu. Click on Convert to faceted form...
Properties - Click Project Facets
Step-4
Click Dynamic Web Project and Java.
Step-5
Click Apply and Ok.
Step-6
Clicks on the “further configuration available…” link.
Choose location where you want to store your .html, .jsp files.
Check generate web.xml
Your project should be converted to Dynamic Web Project now.
I'm going through the tutorial (https://docs.oracle.com/javaee/7/firstcup/creating-example002.htm). I have Eclipse for EE developers (4.6.3) with Glassfish (4.x) properly configured in it.
I see the project folder under glassfish4\docs\firstcup but I don't know how to import it since the instructions are for Netbeans. If I try to "Open projects from file system" or a general import I get just the folder structure in the workspace and not with the right "flavor":
Then Glassfish doesn't recognize this as a resource that can be added. How do I do this in Eclipse?
I was stuck with the same problem.
Here are the steps I took to make it work.
Skip the step where you have to open the firstcup project and build.
When you have to create the dukes-age project and the firstcup-war project, go to File > New > Maven Project.
Make sure the "Create a simple project (skip archetype selection)" option is unchecked. Click Next.
On the next page, you have to select an archetype. Choose "All Catalogs" and type glassfish in Filter and you will see the 2 archetypes you need for the tutorial.
On the next page, you need to enter Group Id and Artifact Id. For the dukes-age project, type firstcup.dukesage.resource in Group Id and dukes-age for Artifact Id. Click Finish.
You will notice that there's an error in your pom.xml file. Open it and edit by removing -SNAPSHOT from the line <version>8.0-SNAPSHOT</version>. Save.
Right click the project in Project Explorer (the left pane). Go to Maven > Update Project.
Skip the step to set the default URL for dukes-age. Instead, when you want to test your completed web service, go to http://localhost:8080/dukes-age/webapi/dukesAge/.
Note for the firstcup-war project. Before adding the project to the server, make sure you start Derby by running ./asadmin start-database inside glassfish5/bin. Otherwise, you have to remove the project from the server and add it back.
That's all. Other than that, everything is quite similar to the steps in the tutorial. Feel free to ask.
I did a sample application mentioned in this link using Netbeans Wizard template https://platform.netbeans.org/tutorials/nbm-wizard.html
But how do I export as executable jar. I just want to execute the project independently with out IDE. Any suggestions.
I can't find it in the tutorial that you point to but in order to share your newly created Netbeans plugin you need to export it as a binary NetBeans Module or .nbm file. Right click on your project and select Create NBM. Check this old tutorial here: http://docs.huihoo.com/netbeans/6.0/kb/60/platform/nbm-google.html
For Netbeans 8.0: When the file is created you can then go Tools->Plugins , downloaded tab and then click add plugins
EDIT (based on your comments)
The tuturial you point to guides you to build a custom Netbeans module (in this case a Wizard). The module is packaged as a .nbm file which you can then distribute it so that it can be installed to any Netbeans IDE.
As it turns out you need something like a "Java swing wizard" application. By searching google you can find some results that fit your needs (these are from the first google results):
http://www.oracle.com/technetwork/articles/javase/wizard-136789.html
https://code.google.com/p/cjwizard/
http://www.javaworld.com/article/2077850/java-se/open-source-java-projects-the-wizard-api.html
http://sourceforge.net/projects/jwf/
Similar question (maybe you can post a comment asking for details there):
https://softwareengineering.stackexchange.com/questions/132723/is-there-a-java-library-to-create-assisted-wizard-flow-into-your-desktop-applica
Hope I am not leading you to the wrong way but another thing you can also have a look at, (haven't checked it myself but you might find it useful) is how to create OSGI modules and the posibility of converting Netbeans modules to OSGI modules.
Look here: http://wiki.netbeans.org/OSGiAndNetBeans.
I had created a dynamic web project. AS of now it has a jsp file which am trying to run. When I tried to associate the project with a specific runtime(tomcat 6.0), it is not happening.
I right clicked on the project/properties/Targeted Runtimes. It doesn't show any runtimes(I have added tomcat 6.0 in servers). When I click the checkbox 'Show all runtimes', everything comes in disabled mode.
What could be the problem ?
Attached screenshot of the problem.
Update: I even tried to create a new runtime and associate it with the project( project/properties/Targeted Runtimes/new). Even the newly created runtime is getting disabled and am unable to associate it with the project.
To add a project to a runtime you must have a match between your project and your runtime; you have to check:
project facet: to run on tomcat it must be a Dynamic Web Project
java version: you can't run for example a java 7 project on a java 6 runtime
web project version: you can't run a project that doesn't match the Java EE version deployable in the runtime
Once you've validated the match between your project and the runtime, you need the project to target the runtime, as follows:
Open the project in Package Explorer, Project Explorer, or Navigator.
Right-click on the project, and select "Properties".
Click on "Targeted Runtimes" in the properties window.
Select the checkbox of the validated runtime that is to be targeted.
Confirm by clicking "OK".
The new runtime will be associated with that project. If a runtime that you want to select is not displayed or is disabled, you may need to uninstall one or more of the currently installed project facets. This can be done within the same Properties dialogue.
This is what worked for me. I'm just posting my method because it might help somebody else.
Right-click on project
Click on Properties
Go to Project Facets
Uncheck Dynamic Web Module checkbox
Click on Runtimes in the tabs on the right. Apache Tomcat vX.x should be available now
Check Apache Tomcat vX.x
Click Apply and Close
Repeat the previous steps 1-3
Check Dynamic Web Module checkbox
Apache Tomcat vX.x under Runtimes should still be enabled
Click Apply and Close
I know it's already answered question, but I like to share my solution with new users if I can help..
For me the problem was because of the Dynamic wen Project version,
3.0 work with java 1.7 ( I was using 3.1) . If it didn't work you can access .settings folder in your project,
org.eclipse.wst.common.project.facet.core.xml file
and set the version that you need.
<installed facet="jst.web" version="3.0"/>
Hope I can help new users
I have Found a fix for this problem.
Go to Preferences and Check your Targeted runtime, If No Runtime is displayed you can Configure it through Feacts. Select Dinamic Web module to 3.0 or 3.1
You can Also refer to this Video for Detailed Explanation. :
https://youtu.be/0W6s0hXbmNE
I am following Google App Engine Guestbook sample to create a new servlet in src folder. When the create servlet dialog open, I found I can't choose or type "Web Project" and can't browse to select "source folder" either.
The eclipse is version 3.5, jdk I installed is 1.6.0_14-b08
I am working on Windows XP Pro with SP3.
Before I tried to create new servlet, I can compile and start the server, after visiting http://localhost:8080, sample app works fine.
Please advise. Thanks.
This happens if none of your projects were created as "Dynamic Web Project". For example if you did :
New --> Maven Project --> maven-archetype-webapp --> etc.
To correct this either create a project via:
New --> Dynamic Web Project
or right-click your existing project and do:
Properties --> Project Facets --> Convert to facet form...
TickDynamic Web Module(verifying the version) then clickOK
Same here. In the Create Servlet dialog (opened by right clicking on the package in my project, New > Other, then choose Web > Servlet), there is no choice in the "Project" drop down list:
The "Browse" buttons for Source folder and Java package doesn't work either.
Installing GWT Web Project and adding such support in the existing project don't help. BTW, the project is already a Web Application Project created following the instructions stated here:
http://code.google.com/appengine/docs/java/gettingstarted/creating.html
Instead, I have to create a Class and then manually set the superclass as javax.servlet.http.HttpServlet to add a servlet to the project.
Is it a bug in Google Plugin or Eclipse?
That may be because you did not installed the GWT (Google Web Toolkit) eclipse plugin first.
alt text http://download.instantiations.com/DesignerDoc/integration/latest/docs/html/gwt/images/web-new-project1.gif
See also this GWT Web Project guide.
solution to this problem is very simple, create a simple servlet file in notepad and copy that file into your projects package folder, and then start editing the file in eclipse.
It's seems to be an old known missing feature/bug.. Gae issue link
From my experience today (06-2014), it has still not been dealt with yet.
Reported by Lars.Vo...#gmail.com, Oct 22, 2009
Eclipse provides a wizard to create new servlets. This wizard allows
to create servlets for dynamic web projects only.
The projects created the the Google Plugin do not have the right
nature, so you cannot use the wizard to create servlets.
Can you please fix this?
Example:
Create a new "Web Application Project". Select File -> New -> Other -> Servlet
Look at the wizard