Netbeans. How to find out referenced libraries (not included in a project code)? - netbeans

I have a netbeans project: java Web Application.
Some libraries in the project are'nt included in code directory. e.g.
....netbeans\7.1\var\cache\index\s717\java\14\gensrc\javax\mail\MimeMessage
so when I clone the project in other machine the library isnt found, because the netbeans directory is different. Is there a tool that check it? Maybe a netbeans plugin. thanks!

Try right-clicking on the Libraries in your Netbeans Project Browser, and selecting "Add JAR/Folder". From there, navigate to the JAR you want, and select "Reference as Relative Path".

Related

Easy way to find which Eclipse version and plugins are needed for existing Eclipse project

I was given a working Eclipse project in Java. If I open it in some version of Eclipse then I get numerous errors. I get them because my version of Eclipse differs (it is not web developer) and vaadin and ivy plugins were used to create the project. How can I understand which version of Eclipse and which plugins are needed? I can get some sense by looking in .setting folder. There are a lot of files with names as namespaces related to plugins. Is there more direct or automatic/semi automatic way to find which plugins and Eclipse version are needed?
No. The Eclipse developers expect you to know your tools and if you take over a project from someone else or join a project, that someone explains to you how to install and configure Eclipse.
To find out which Eclipse plugins you need, look into the file .project and the folder .settings. Google for the file names and plugin IDs to see what they might mean. Usually, the third word of the name is the project (org.eclipse.jdt.* -> JDT project).
For missing classes, you need to look at the classpath. The easiest way to do that is to right-click on your project name and then select "Properties" from the menu. There is an entry "Build Path" which contains all the dependencies. Click through the tabs to see what you need.
For plugin projects, look into the file META-INF/MANIFEST.MF; Eclipse should open a special editor when you open it which has a tab for dependencies.

How to use SVN to build a library

I am trying to follow a tutorial, and I am told to:
1- Get the source code for the Java EMV Reader library from http://code.google.com/p/javaemvreader/ and build it.
2- Drop the resulting jar file in lib/.
3- Import the project in Eclipse and build it.
I right click the java files, and choose run as but don't get an option to run as Java Application. I also can not export the files as a JAR file. I have enclosed an image of what I have
After the first comment, I right clicked on my project, and under Maven, chose the option "configure as Maven" project. ( Thank you so much; this must be one of the fastest resolutions in the world )And I can now run the project. I get the window in my pic2, which I have attached. I don't however know what step 2 of the above instructions means. I don't see a lib/ folder. And the project he is refering to in step 3 is on git. Any ideas on what he means? ![pic2]!1
Eclipse projects have a "type" and that controls what tools are available. You probably created a "Basic Project" which means there are no compilers or other Java tools associated with it. You would want to create a Java Project in Eclipse.
That project does not seem to have Eclipse .project and .classpath files checked into the repository. It does look to be a Maven project however. So you would either want the m2eclipse plugins installed, and check this out as a Maven project, which would handle configuring everything else, or you want to use the Checkout As ... option and use the wizard to create a new Java project to checkout.
These are more Eclipse IDE questions than SVN or Subclipse questions.

How to change Liferay Portlet Plugin API library in Eclipse?

I have switched my web-application to run on another installtion of Liferay. Consequently, I was able to changle classpath libraries in my project to new server location. This includes JRE System Library and Liferay v6.0 CE. I.e, both these libraries can be added for new server location from Java Build Path dialog.
But the library "Liferay Portlet Plugin API" still refers old Liferay installation path and I see no way to change it.
How is it possible?
UPDATE 1
Here: http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Getting+Started+Tutorial
On the very most low picture you can see all three libraries listed in Package Explorer. Two of them I was able to change and the question is about third one.
You can manually change file .metadata\.plugins\org.eclipse.jdt.core\variablesAndContainers.dat.
So open your filesystem browswer (My computer) navigate to your liferay IDE workspace location and go to .metadata\.plugins\org.eclipse.jdt.core. Open file variablesAndContainers.dat and find and edit your jars locations.
After that restart Liferay IDE or simply close and open your project.
UPDATE:
1) Take note of jars that are needed
2) Go to configure build path dialogue than go to libraries and select "Liferay Portlet Plugin API" then click Remove
3) Create folder "lib" directly in your project (not WEB-INF/lib)
4) Add jars to lib folder (from 1.)
5) Select jars and add them to build path (right click - Build path - add to build path)
Or you can crete you User libarary with those jars and than add it to build path
Additionally to chosing correct libraries in classpath dialog, one should also change "target runtime" appropriatedly by right click project and going to properties > Targeted Runtimes.
P.S. And plus one should close project and then open it again.
in my case, following instructions in this question about clearing eclipse cache (-clear option) helped, as changing liferay plugins SDK path wouldn't change the libraries' locations when adding this library to project build path...

Import Libraries in Eclipse?

I just recently downloaded the dom4j library, but for the life of me I have no idea how to access it. I dropped it in the plug-ins folder and rebooted Eclipse, without success. For some reason finding a straight answer for this is more difficult that I thought it would be.
No, don't do it that way.
From your Eclipse workspace, right click your project on the left pane -> Properties -> Java Build Path -> Add Jars -> add your jars here.
Tadaa!! :)
Extract the jar, and put it somewhere in your Java project (usually under a "lib" subdirectory).
Right click the project, open its preferences, go for Java build path, and then the Libraries tab. You can add the library there with "add a jar".
If your jar is not open source, you may want to store it elsewhere and connect to it as an external jar.
For the Android library projects, I do it as in the attached screenshot:
Right click the project, select Properties->Android and in the library section click Add. From here you can select the available libraries.
If you are importing a jar file, then importing them as jar or external jar, as other posters posted would work. I prefer to copy/paste jar file in the libs folder (create one if it doesn't exist) and then import as jar.
If you want to get this library into your library and use it, follow these steps:
You can create a new folder within Eclipse by right-clicking on your project, and selecting New Folder. The library folder is traditionally called lib.
Drag and drop your jar folder into the new lib folder, and when prompted select Copy Files.
Selecting the Project tab at the top of the screen, and click Properties.
Select Java Build Path followed by the Libraries tab.
Click the Add JARs… button and select your JAR file from within the lib folder.
Your JAR file will now appear in both the lib and Referenced Libraries folders. You can explore the JAR's resources by clicking Referenced Libraries.

Migrating From NetBeans to Eclipse

My company wants to migrate to Eclipse, I was wondering what options besides an Ant build are there to move our projects from Netbeans to Eclipse.
Tooooo ... oooo .... oooo late to answer but this works
http://www.coderanch.com/t/458555/vc/Export-Netbeans-Eclipse
i was looking for an answer my self and saw this question :)
Quoting:
Here is a little tutorial on "Importing projects from NetBeans to Eclipse".
Please try this:
PART I - NETBEANS
Open NebBeans.
Create a java project named "ToEclipse".
Build this project.
Then, NetBeans has created several folders. The important folders to us are (in my computer):
c:\User\Almir\NetBeans\ToEclipse\dist
c:\User\Almir\NetBeans\ToEclipse\src
PART II - ECLIPSE
Go to Eclipse.
Create a java project in Eclipse named "ToEclipse".
Then, Eclipse has created several folders. The important folders to us are (in my computer):
c:\Users\Almir\Eclipse\ToEclipse\bin
c:\Users\Almir\Eclipse\ToEclipse\src
PART III - WINDOWS EXPLORER
Go to Windows Explorer.
Copy the FILE "ToEclipse.jar" at c:\Users\Almir\Eclipse\ToEclipse\bin folder.
Past it in c:\Users\Almir\Eclipse\ToEclipse\bin
Copy the FOLDER "toeclipse" at c:\User\Almir\NetBeans\ToEclipse\src folder.
Past it in b) c:\Users\Almir\Eclipse\ToEclipse\src folder.
PART IV - ECLIPSE
Go to Eclipse.
Press F5 to refresh the view.
Verify that your project is there (under ToEclipse/src/toeclipse).
Say "Oh! Yes! It works!".
Run the project.
Return to 3) how many times you want!
I hope that helps you!
Kind regards,
Almir Campos
São Paulo, Brazil.
I found another easier way that worked for me at least since I had problems importing the Ant build script due to a missing javac.
Say you have your Netbeans project (src, build, dist etc) in D:/blah/
In Eclipse go to File->New->Java Project
Uncheck 'Use default location' and instead use the path where the Netbeans project is (D:/blah/) Eclipse should automatically populate everything else and link to the files as well.
I have recently 'migrated' from Netbeans to Eclipse and found it amazingly easy. The reason it was easy though is that all of our projects are IDE independent standard ant and ivy build scripts that most modern IDE's can understand. This way, we all get to use the IDE we like (yes - emacs and vi too) and their are no 'migration' issues.
The reason that I am pointing that out is that, if it is not already that way, I would recommend that you take that same path on your migration. Just create some standard ant (and ivy) build scripts. Eclipse knows how to slurp those in and there will be no future migration issues.
in MY PERSONAL experience, it was easy. I was migrating a java desktop app from netbeans to eclipse. Just copy my projects into the workspace, create the project in eclipse as a new java project and put the same name of the project in netbeans (use your workspace as location). It will recognize the project structure ( Eclipse Helios, Netbeans 6.8 )
Hope this helps. I don't know how hard it turns if you have another kind of project.
I just migrated a Netbeans 7.0 JSF web project to Eclipse. And it was easier than i would have imagined.
What i did was:
List item
Clean and build my JSF application in netbeans
Close netbeans and open Eclipse(i use galileo)
Create a new Dynamic Web Application.
Right click on the new web application in project explorer and go to import then to .WAR file
It then ask whether i want to import any of the jar files(libraries) as projects and i do not select any and just click finish.
Copied my netbeans src(source) folder /src/java/ to
the Eclipse src folder. e.g netbeansproject/medman/src/java/com to eclipseSpace/medman/src/
Next setup your server in Eclipse(i use tomcat 6.0).
And voila! it is done.
You can also check out this link. http://www.coderanch.com/t/458555/vc/Export-Netbeans-Eclipse
At my company people pretty much use either eclipse or Netbeans. I myself use both of them for various tasks. We write our own ant scripts to build and package our source so it does not matter what IDE a person uses. I would suggest that you create your own ant script to build your source, that way you won't have to depend on an IDE specific build script.