How to import javascript based template into Java EE eclipse? - java

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.

Related

Associating an eclipse project with a tomcat server

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).

Export wizard application in netbeans

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.

Unable to associate project with a runtime server in eclipse IDE

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

Converting an Eclipse Java project to a Google AppEngine one

I have a project with a large amount of pre-processing. I have written this part and would now like to convert the project to a GAE project.
I have enabled the GAE support in Project->Properties and have some functionality but when I want to testrun the app I get a "Web application archive directory does not exist."
Is there a way to automatically generate the missing folders and files or do I have to do that manually?
I do not want to copy my classes into a newly created project since that would mean loosing all my version control.
I think that with the GAE plugin for Eclipse, you can create a GAE app skeleton. You just have then to move your old project files into this project, and you're done.
For just conversion, I don't know if it's possible, if the structure of your app is completely different from the GAE structure.
As for the error you have, it seems that your app lacks a WEB-INF directory that any webapp needs to run.
I am using GAE Eclipse Plugin 1.2.1 and Eclipse 3.4.2 and I have tried the same operation and have been unsuccessful so far. I believe the eclipse plugin is hardcoded to look for the various components at specific locations. (The right approach would have been to configure the GAE plugin to look for the all the WEB-APP components at other locations than the default.) I would think that given these versions, converting an eclipse project directly wouldn't be possible.
A possible solution, given this constraint, would be create a new GAE project and copy all your existing code into that structure without altering the folders already created by the GAE plugin.
Don't know if this will work for Java -> GAE project conversion, but I've had luck doing something similiar, converting General -> Java projects using the following steps:
Close your project.
Open your project file (which is located in your root directory of the appropriate project) called .project with your default editor. Search for:
<natures>
</natures>
and change it to
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Store the changed file.
Open the project again - now it's a java project.
Of course you'll need to create a new GAE project and then look inside its .project file to get the correct element contents.
I found the above steps googling around, so I can't unfortunately credit the original source of the above instructions.
You CAN convert your existing eclipse projects to GAE projects. All you need to do is right-click the project and choose settings. Then choose Google settings and tick the "use Google App Engine SDK" option.
Using Google Plugin for Eclipse with existing projects
Not sure about the whole GAE specific stuff, but you can copy your old projects contents:
Create new GAE-Project
Close it
Use a file manager outside eclipse to copy all your old projects contents into the new project. Make sure, you include the ".svn" folder, it may be invisible in the explorer/nautilus/whatever. You should also think about leaving the .project file of the new project alone, as it may contain GAE specific configuration.
Open the project in Eclipse again
Right click project -> Team -> Share project -> Select SVN
Your old project URL should be already there, leave the radio button with "Use project settings" checked.
The project connects back to the old repository location, and in sync view you should see the new files as outgoing.
To complete #Marks response, you should add this line to your .project file:
<nature>com.google.appengine.eclipse.core.gaeNature</nature>

Could not create servlet in web application project (google app engine) by using eclipse

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

Categories

Resources