How to use Jsoup in Eclipse - java

I just downloaded Jsoup to use in a program I'm writing in Eclipse. My program uses Seam and I can not figure out how to include the JAR file for Jsoup in my program. Any help would be greatly appreciated. Thanks

Drop the JAR file in /WEB-INF/lib folder of the WAR, or in the /lib folder of the EAR. Eclipse will do the remaining necessary magic. Don't fiddle with project's Build Path properties or things may go worse.

I did what BalusC recommended above, but I also had to 'refresh' Eclipse in order for the .jar file to be recognized. To refresh, just right-click on the left side window pane within Eclipse and select refresh.
Eclipse Version:
Eclipse Java EE IDE for Web Developers
Version: Kepler Service Release 1
Build id: 20130919-0819
OS: Fedora

Related

WebContent folder does not exist, webapp instead

I'm taking the following course right now: "Develop websites with Java EE".
I encounter a problem when creating the Dynamic Web Project because instead of having a WebContent folder like on all the tutorials I've seen, I get a src/main folder...
What should I do to be able to have a WebContent folder
The Eclipse for some reason replaced WebContent with webapp folder.
It is basically a replacement for it, but if you really want WebContent you can download 2017 version.
Here is the one that I have
Eclipse Java EE IDE for Web Developers.
Version: Oxygen.1a Release (4.7.1a)
Build id: 20171005-1200
https://www.eclipse.org/downloads/packages/release/oxygen/1a
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/1a/eclipse-jee-oxygen-1a-win32-x86_64.zip
After this version WebContent is replaced with webapp
Here is also a picture of the project structure if you have an eclipse that creates webapp or WebContent, as you can see it is basically a replacement to make it look more like maven structure.
"WebContent" was replaced to form a layout more easily transitioned to building a .war file with headless tools like Gradle and Maven. No one should be deploying to a production environment from their IDE. "WebContent" was also fairly unique to Eclipse's Web Tools. There's nothing special about it.
You don't need an older version, only to enter a different value when the New Dynamic Web Project wizard asks you what you want to use as your Content Directory on the third page of the wizard (if you don't want to use the new default):

IntelliJ IDEA project modules are not auto identified on WSL

The files within my Gradle project are not identified by IntelliJ when a project in WSL (Windows subsystem for Linux) is opened by IntelliJ IDEA Ultimate. Correct java versions are also installed within WSL and the paths are also set correctly.
This is a Gradle project and my java files are shown with a red icon on them and it says "Java file outside of source root".
Then I went to File -> Project Structure -> Modules, and observed that the correct modules were not identified.
When I open the same project in Windows or Ubuntu, the modules are automatically detected and I don't need to add them manually.
How I opened the project is using File -> Open on IntelliJ for Windows and gave the project path within WSL (E.g. \\wsl$\Ubuntu-20.04\home\username\idea-project).
My Gradle versions is as below,
Has anyone come across any situation like this that could help me figure out what is the issue behind this.
Thank you.

How to remove reference of a jar file in a java based web application?

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

Google web toolkit with Netbeans?

I prefer to use Netbeans as my IDE rather than Eclipse. A few years ago when I looked into Google Web toolkit, there was no good Netbeans plugin for GWT and everyone suggested to use Eclipse. How is the situation now? Is there any better plugin on the market, or is Eclipse the best option?
I prefer Netbeans over Eclipse too. To develop for GWT, I used the following setup steps without installing gwt4nb plugin. Since I use an IDE for code analysis and editing help only, and feel quite comfortable manipulating files and directories in the source tree directly. Though this may not fit your case, I guess for many developers the steps should be good enough because you can treat gwt development just a normal java project.
Install JDK, NetBeans-SE. Extract gwt package. I have a note for gwt-1.7.1. If running on a windows 64bit version, install 64bit netbeans and jdk, and also a 32 bit JRE.
Copy the Hello sample from gwt directory to a directory out of gwt package directory. Create a project of existing java source code, and put the project under the same Hello directory. Then netbeans will create two files in the Hello directory: nbbuild.xml and manifest.mf, and create its own nbproject directory under Hello. I simply ignore these files.
In netbeans "Projects" window, right click on "Libraries" and choose "Add JAR" to add the jar files from the gwt directory.
In netbeans "Files" window (not the "Projects" window), you will see the original "build.xml" file that comes with the Hello sample. Edit this file so the "gwt.sdk" points to the location of gwt package directory. On windows 64bit, also add a "jvm" property under "java" task. It shall look like (only jvm=... is newly added):
<target name="hosted" depends="javac" description="Run hosted mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.HostedMode"
jvm="C:\\Users\\youhere\\Programs\\jre6.32\\bin\\java">
<classpath>
Use "Files" window, click to expand "build.xml" file node. Then right click on "hosted" ant target under "build.xml" and choose "Run Target" in the context menu to build and run the hosted mode.
The ant targets from "build.xml" you usually use:
"build": Use this to build the javascript.
"hosted": Use this to build java and start hosted server and browser.
Once the hosted server is started, you can run "build" target to build the javascript and to have the result served by the running hosted server immediately without restarting the server. Use your normal browser to see the javascript version at "localhost:8888". You can set a different port by editing the "build.xml" file.
Usually I copy the Hello sample to a different directory, and use that as a start point of a new project. After that manually edit the files to match the project naming and directory structure.
I also copy the other samples from gwt package to a new directory, then build and run them to use that as a code reference. If you want to also develop the servlet, take a look at the servlet of DynaTable sample and create or copy the files into the same directory structure in your project.
A note about gwt4nb plugin: I installed it but figured out it is too heavy weight for me. With the above manual setup, I can do everything that I need to without any difficulty.
I would say Eclipse is the best free option. Intellij IDEA (paid edition) has also good GWT support but it is not as good as Eclipse.
I think the only official support goes for eclipse, see here : https://developers.google.com/web-toolkit/download
Based on my personal experience, if you want to have a good integration between GWT and your IDE, go for Eclipse. If you intend to use Maven, I also suggest M2E http://m2eclipse.codehaus.org/
EDIT
Forgot to say the most important thing. Netbeans by the way, seems to have a nice support of GWT but I never tested, see : http://netbeans.org/kb/docs/web/quickstart-webapps-gwt.html
I am sure this is not the correct and suitable answer. But if you like to trade off, this is just an idea.
sudo -i
cd ~/gwt
./projectCreator -ant build -out projects/myapplication
./applicationCreator -out projects/myapplication myapplication.client.MyApp
Then, you can import the project ...
In Netbeans create a new projects and choose 'Java Project With
Existing Ant Script',
Set Location to the myapplication folder created earlier
Set Build Script to the build.ant.xml file created by projectCreator
Set Project Name to something more appropriate
Open the project properties and under Java Sources click Add Folder.
Select the projects/myapplication/src folder and press OK
Please excuse, if you didn't like this approach.
Sounds similar with Battle for Eclipse and Netbean but you are talking about concern with GWT.
So , I think you can choice as you more prefer depends on your experiences. You can do GWT developing in various IDE because I assume GWT runs on it's SDK not on IDE . But there has some points of views. Example : easy to generate , test , develop ..etc on each IDE.
I also personally love NetBean due to beautiful GUI :) . But I am working with Eclipse IDE because our team has been developed and configured on it for a long time so we have hard to change IDE (sometimes very hard to change Eclipse version because we can't imagine new version will more reliable for our projects).But I don't mean Eclipse is the best option , as I described you may configure your GWT projects on any other IDE also as your experiences via GWT SDK.
"...and everyone suggested to use Eclipse." . Yes you will see most of sample projects for it were figured with Eclipse IDE. Only aspect for GWT , I think you have chance to choose NetBean IDE without any worries.
You can develop GWT project on NetBean IDE as follow...
1.) First off, download and install the gwt4nb plugin. ( you may have exp for install plugin on NetBean IDE )
2.) download GWT SDK and extract it to your specific location.
3.) create a new Java Web –> Web Application. Name your application and hit Next until you get to the Frameworks tab. If you have successfully installed the gwt4nb plugin you should see Google Web Toolkit listed. Select the Google Web Toolkit framework.
4.) Next, browse to the GWT SDK installation folder. Name your GWT module and hit Finish.
5.) Clean and Build your project.(don't be forgot to wait until successfully finished Build.)
6.) Run the project, your browser should launch and the button “Click me!” and the text “Hello, GWT!!!” should be visible.
Cheer ! now you can create GWT sample project on NetBean IDE.
You can also create GWT's
Test Case
Constants
Module
RPC Service
UiBinder
By right click on your_project > Other... > Google Web Toolkit.
Have some useful tips for you !

Deploying existing webapp using Tomcat

There is a web app that I need to deploy, and was wondering what the best way to do this would be. I'm using a Mac OSx with eclipse indigo. Also, this application needs to be imported into the eclipse workspace first. Any help is greatly appreciated.
In the eclipse menu, there's an import option. Select it, choose your app, and that should be enough.
If you want to just deploy the app without eclipse, simply place the .war file in the tomcat directory (the root directory for its apps), and when it loads, it will automatically extract it.
In addition to #Eran Zimmerman answer, you could just make symbolic link to your .war file into deploy directory (it will be automatic extraction when .war file changed).

Categories