Import a war in IntelliJ - eclipse

I have worked on eclipse before and new to IntelliJ.
I have a war with me(its an example from apache). I want to import it to intellij. but it seems that IDEA does not support importing. I also have unpackaged version of the war file.
How can I import or do equivalent in Intellij and get all the contents?

If you mean that war also contain the source java Code, "myclass.java" here is the answer :
There isn't a direct way I know about :
first open WinRAR
drag the war file into WinRAR
extract content
copy the HTML, JSP, etc. files and css, javaScript folder to the "web folder in your project" (you should create new one before starting).
navigate to class folder deleted all .class file keep only .java files
take all folder copy to " src folder in your project "
the import thing don't forget to copy the deployment descriptor "web.xml"
finally rebuild the project

Related

NetBeans Include External JAR in Export to Zip

I have a NetBeans project that uses the GSON library. I've tried including the GSON.jar file without requiring future users to separately download it. However it doesn't seem to work. The project looks for the file from the relative path of my computer so the file isn't found on another user's computer. Is there a way to include GSON.jar and "Export to Zip" and keep the reference in the project itself? I'm lost!
Thank you
Exporting a Project to ZIP zips up the project folder only, and not anything outside of the folder, including dependencies. If you include the GSON.jar file in the project folder, then the JAR file will be included in the .ZIP file. It's a good practice anyway since NetBeans will use a relative classpath and thus if you move the project itself NetBeans won't give you an error message when loading the project.

jar to eclipse project

I got a .jar file which I need to import into Eclipse. However, I don't want to have the jar as a referenced library. I need the .jar to be included like a "normal" project, with packages(!) and .java files.
I tried to do the following: New Java project -> Import -> General -> Archive File. In this case, when I place this jar also as a referenced library, it is imported but with .class files.
New Java Project -> Import -> General -> File System. Imports the .java files, but the packages are lost and are normal folders. Also, the files are somehow strange, because the "j" in the icon looks differently, and errors are not noticed (no underlining)
Importing "Existing Projects into Workspace" doesn't work at all, it says that there is no project. I also tried to import the jar as a zip after extracting it, this gives me the -java files, but it destroys the packages.
Does anyone know how to import this correctly?
What are you trying to do here ? .jar files would contain .class files not .java files. Either you need to have the corresponding source in the jar or you gotta get a decompiler associated with Eclipse.

trying to use tess4j for the first time with eclipse(any step by step for trully beginner)

I need a step to step on how to plug tess4j to Eclipse.
I found this online:
creating a lib directory and copied the tess4j.jar and its required jar in;
added the jars to build path
copied the tessdata directory and tessdll.dll file into the project root directory.
Now it just works.
I only know basic Java so I have no idea what creating a lib directory and copy directory file means at all.
Can someone help me to plug this library and make it work for eclipse because I am working in a project that needs ocr.
creating a lib directory and copied the tess4j.jar and its required jar in;
A JAR (Java ARchive) file is a collection of compiled Java classes. This is the usual way to distribute Java libraries. You should create a new folder in your project (right click your project, "New", "Folder") and copy/move the JAR you downloaded to this newly created directory. If tess4j has dependencies, i.e. needs other JARs to work, you have to put them in this directory.
added the jars to build path
You need to tell Eclipse to add the JARs to the build path, i.e. Eclipse needs to know where to get the tess4j classes from. Locate the lib folder and select all JAR files. Right click them and select "Build Path", "Add to Build Path".
copied the tessdata directory and tessdll.dll file into the project root directory.
Should be clear ;-)

How to create .classpath and .project files to make a project compatible with Eclipse Helios?

I am having a Java Web project with some class files, JSP files along with WEB-INF and META-INF folders. I want to use this project in Eclipse Helios.
For this I will need to import this project. However, Eclipse will search for .classpath and .project files in the root directory of the project. And unfortunately, I don't have these.
So, can I create one from the project?
Or do I just have to create one project and copy the files into the project? Though this will be a little tedious task if I have too many packages and class files.
Or do I just have to create one project and copy the files into the
project? Though this will be a little tedious task if I have too many
packages and class files.
It isn't tedious. Just create a blank Dynamic Web Project in Eclipse and copy the source folder. You can add a "Source Folder" to point to where your Java source files are present. It will then automatically add all the packages under it.

How do I deploy/import war package into Netbeans

I have looked through the help documentation in netbeans 6.5.1 but cannot find anything explicit explaining how to deploy/import a war package.
I know in Eclipse, it's as easy as right clicking in the Project Explorer >> select IMPORT >> WAR FILE.
However, I still am unable to find a solution for Netbeans.
Thankyou,
Jordan
posted elsewhere, thought i might post here too.
after some googling I've found the solution and here are the steps:
(tested using apache's ode.war in NetBeans 8.0)
unzip the war file
in the unzipped folder, you will see WEB-INF/, META-INF/, etc., create a sub-folder named web in the unzipped folder.
put everything else into web (now they will be web/WEB-INF/, web/js/, ...)
go to netbeans, new project -> java web -> web application with existing sources
pretty much just press next all the way through. voilĂ , it's done.
I assume you don't already have an ant or maven project for your web project? If you did, you would just import a maven project or create a Web Free-Form Application and wire it up to your ant script.
I would unzip the war file, create a new web application with existing sources in netbeans and wire everything up using the wizard.
Import the war project to eclipse.
Then import the eclipse project to netbeans
If you don't have eclipse handy, just place the war file into the webapps folder of Tomcat, go to the bin folder of Tomcat and run startup. Tomcat will automatically extract the war file for you. Now go to the webapps folder and you'll find another folder there, with the same name as your war.
I couldn't find an option to import a war directly into Netbeans (strange. Perhaps someone could create this feature and submit it as a patch to Netbeans). The folder which gets extracted into the Tomcat folder can be used as the Netbeans project. It's advisable to copy it to some other folder first. Import by File > New Project > Web application with existing sources.
Eclipse has an option to export a war and include the sources with it too, so there's a chance that the source files are in the war too.