I've tried adding .jar files to the Global Libraries section in settings, but whenever I create a new project, those libraries still have to be manually added to the project.
I've consulted the documentation on Jetbrains's site (https://www.jetbrains.com/idea/help/configuring-project-and-global-libraries.html) and I seem to be doing everything correctly.
With only the Welcome to IntelliJ IDEA window open, I've performed the following steps:
Open Default Project Structure options with CMD+;
Select Global Libraries from the left pane.
Click the + in the second pane and select Java.
Navigate to and select the jsoup-1.8.2.jar file which is the library I am attempting to make global and then select OK.
Click OK to close the Default Project Structure options window.
Select Create new Project
Select Java from the left panel and then select Next.
Select Next again.
Name the project and select Finish.
At this point the only External Libraries added is <1.6>.
So I have to proceed by manually adding the library to the project.
How do I set IntelliJ IDEA to load specific libraries automatically when creating new Projects?
Global libs are "global", so it can be used in multiple projects, so the real question is How does IJ know if you want to use this global lib in to "this" project ?
b/c the way "global libs" woks is you could have python virtual-env as global lib, you could have django libs there.. any named-custom set of jars could be a global lib etc..
so how does ij know-- you need python or django etc in this project? that's why you have to tell/add it manually deciding which one is needed for this project.
So I want to have a 'utility project' with all the utility classes and the utility libraries in it (say apache commons libraries under a particular directory called libs in the utility project). So that I can add this 'utility project' to a new project and want to use its java classes and jars both. I know when you add a project you can use its java classes but can't use the jars. Anyway to do this?
You want to create a dependency relation between the two projects. This is better than just adding external JARs as it will keep track of the actual libraries in the utility project even if you change its name or location. To achieve that you need to do two things (although, I believe only step (a) is new to you. If I understand correctly you actually have already carried out (b)).
(a) Go to your utility project then do:
Project -> Properties -> Java Build Path -> Order and Export
Check all the JARs that you'd like to make available to the other project.
(b) Go to the other project (the one that uses the utility project):
Project -> Properties -> Java Build Path -> Projects -> Add
Check the "Utility Project"
You should now see your utility project in the list of projects:
In the properties of the project (from Package Explorer > Right Click > Properties) browse to 'Java Build Path' > Libraries tab.
You can then select the 'Add External JARs' button and add the required jars.
right click on the project where you want to add jars and then select properties. After that select Java Build Path and then click on Add External JARs. You should be able to add jars from here. See following pic, for more info.
Note: You can add reference to projects by clicking on projects tab in same window.
I would suggest you try creating a new "user library" in eclipse which you can use in your projects.
An EclipseSW User Library can be used to represent a set of jarW files. This user library can be added to a project's classpathW. Thus, a user library can be a convenient way to add a set of jar files (rather than individual jar files) to a project's build path. Here, I'll create a user library for a set of TomcatSW jar files.
To create a user library, you can go to Window → Preferences and go to JavaSW → Build Path → User Libraries. I'll click the New button to create a new user library.
More on user libraries at this link
http://www.avajava.com/tutorials/lessons/how-do-i-create-an-eclipse-user-library-for-the-tomcat-jar-files.html
Other ways of doing this at the link below
http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)
I am using external jar file in project, but I don't have any idea how to add doc for same project in Eclipse.
I followed TIPS but it's same, nothing reflect on use of
Content assist(Ctrl-Space).
Any suggestion?
To add an external library to a project, right click the project and select
Build Path | Configure Build Path...
Hit the button:
Add External JARs...
and select the archive of your choice. Now click the small triangle, which is to the left of the archive, and select:
Javadoc location
Hit the button:
Edit...
and select once again the archive containing the JavaDoc. You may and should do the same for:
Source attachment
If you add the source archive, eclipse will generate the Javadoc on the fly for you. Hence, adding the Javadoc location is kind of obsolete. If you like to read the rendered Javadoc like in a browser, open the Javadoc View by selecting:
Windows | Show View | Javadoc
or pressing:
Alt + Shift + Q, J
Goto
Windows/Preferences
This will open a window for you. In left menu goto:
Java/Build Path/User Libraries
There on the right hand side, locate new button and create a new User Library. You can then see the Add Jars button will be enabled. You can add your jar file into your library then.
To include library into your project. Right click on your project and goto Build Path -> Add Libraries option. Add your library and use it in your project.
If jar is loaded properly so the java docs will. In order to load jar copy that into your project. In eclipse explorer right click on jar and select--> Build Path --> Add to Build Path
and its done.
Or it is better to use some build tool like maven to import external jars.
Have you configured the Preferences of Content assist through Preferences » Java » Editor » Content Assist » Advanced in Eclipse?
Presently I'm working with JavaFX. Whenever I hover over a method of JavaFX its gives me the following error:
'Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found'
How should I resolve this? How can I attach the javadoc or source so that I could see the description of the methods?
Download jar file containing the JavaDocs.
Open the Build Path page of the project (right click, properties, Java build path).
Open the Libraries tab.
Expand the node of the library in question (JavaFX).
Select JavaDoc location and click edit.
Enter the location to the file which contains the Javadoc (the one you just downloaded).
You can configure the Javadocs with downloading jar, basically javadocs will be referred directly from internet.
Complete steps:
Open the Build Path page of the project (right click, properties,
Java build path).
Open the Libraries tab.
Expand the node of the library in question (JavaFX).
Select JavaDoc location and click edit.
Enter the location to the file which contains the Javadoc.
Specifically for the javaFX javadoc enter http://docs.oracle.com/javafx/2.0/api/
for offline javadocs, you can download from : http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html
After clicking Accept License Agreement you can download javafx-2_2_0-apidocs.zip
Neither Project/Properties/Javadoc Location nor Project/Properties/Java Build Path/Libraries had not helped me until I picked and moved up in "Order and Export" tab of "Java Build Path" "Android Dependencies" and added-in-library.jar. I hope it will be useful.
Alternatively you can also,
1) Navigate to that method by Ctrl+Click on the method. The new tab/window will opened with text "Source not found" and button "Attach Source.." in it
2) Click the button "Attach Source.."
3) New window pops up. Click the button "External Folder"
4) Locate the JavaFX javadoc folder. If you are on Windows with default installation settings, then the folder path is C:\Program Files\Oracle\JavaFX 2.0 SDK\docs
First, if you get the message
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found
Then it means that you've already included the external jar needed for your project.
The next step would be to associate the external jar with its javadoc url.
go to package explorer, expand your project folder, expand referenced libraries
right click the external jar that you want to associate its javadoc with
click properties -> javadoc location
copy and past the url for the javadoc that you googled online into the javadoc location path
click apply
And you're all set!
Above all answers are right but there is another method also which is very handy.
Pre-condition: Your project is Maven project Or converts it to Maven project.
RightclickOnProject > Configuration > Convert in to Maven Project
- Now follow the steps:
1. Select any jar for which you want to download sources or javadocs.
2. RightClick > Maven > Download javadoc or Download javasources
I couldn't get the "Attach source..." method to work either, and I tried many different ways. The Javadocs for JavaFX are installed in Program Files\Oracle\JavaFX 2.x SDK\docs. Another way to install the Javadocs is:
Right click on the project, select Properties
Select Libraries on the right side of the tab
At the right top side of the tab, you may see "Default JavaFX Platform" or something similar. Click on the Manage Platforms button. (You can also install this default platform from here if you haven't got this already).
In the Java Platform Manager tab which appears, select "Default JavaFX Platform" on the left side, and then click on the JavaFX tab on the right side of the window.
One of the entry fields is labeled "JavaFX Javadoc". Click the "Browse" button next to this field and browse to the installed docs file mentioned above.
Hope this helps some people who were as puzzled as I was.
In addition to the answer of #dhroove
(would have written a comment if I had 50 rep...)
The link has changed to:
http://docs.oracle.com/javafx/2/api/
At least my eclipse wasn't able to use the link from him.
It already in a different thread, just a simple eclipse setting will automatically download JavaDoc (but, you need to click the method for first time).
Where can I download the JavaDoc for JPA 2.0?
This trick worked for me in Eclipse Luna (4.4.2): For a jar file I am using (htsjdk), I packed the source in a separate jar file (named htsjdk-2.0.1-src.jar; I could do this since htsjdk is open source) and stored it in the lib-src folder of my project. In my own Java source I selected an element I was using from the jar and hit F3 (Open declaration). Eclipse opened the class file and showed the button "Attach source". I clicked the button and pointed to the src jar file I had just put into the lib-src folder. Now I get the Javadoc when hovering over anything I’m using from the jar.
If you are using maven just do:
mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
You could specify the online Javadoc location for a particular JAR in Eclipse. This saved my day when I wasn't able to find any downloadable Javadocs for Kafka.
In the Package Explorer, right click on the intended JAR (under the project's Referenced Libraries or Maven Dependences or anything as such) and click on Properties.
Click on Javadoc Location.
In the Javadoc location path field under Javadoc URL, enter the URL of the online Javadocs, which most likely ends with /<version>/javadoc/. For example, Kafka 2.3.0's Javadocs are located at http://www.apache.org/dist/kafka/2.3.0/javadoc/ (you might want to change https to http in your URL, as it raised an invalid location warning after clicking on Validate... for me).
To attach the Java source code with Eclipse,
When you install the JDK, you must have selected the option to install the Java source files too. This will copy the src.zip file in the installation directory.
In Eclipse, go to Window -> Preferences -> Java -> Installed JREs -> Add and choose the JDK you have in your system.
Eclipse will now list the JARs found in the dialog box. There, select the rt.jar and choose Source Attachment. By default, this will be pointing to the correct src.zip. If not, choose the src.zip file which you have in your java installation directory.
java source attach in eclipse
Similarly, if you have the javadoc downloaded in your machine, you can configure that too in this dialog box.
How do I use simple in eclipse?
Do I add it to the JDK?
http://simple.sourceforge.net
The web site seem to have allot of info on using the methods but little on setting up the library.
I have used C and C++ to set up external libraries before but the Java set up confuses me.
Thank you!
In java world, in order to be able to use third party libraries, what you need to do is to add them to your project/application's CLASSPATH. In case of Simple, its library file is simple-xml-2.4.1.jar that is located inside a folder "jar" within the simple-xml-2.4.1.zip that you would download from Sourceforge.
Download and unzip the
simple-xml-2.4.1 Archive. (ZIP file).
Note that it has a Jar folder that
contains simple-xml-2.4.1.jar - that
is the library eclipse and other IDES
would use to set up the CLASSPATH
Goto your project in project
explorer.
Right-click on the project name and
select "Properties". Alternately, you
can click on the project name and
type "Alt+Enter". A window will
pop-up.
In the window, select "Java Build
Path". You will see several tabs,
including "Source", "Projects" and
"Libraries".
To add simple-xml-2.4.1.jar to your
project, click on the "Libraries"
tab. From there, you can add either
internal jars or external jars. The
"Add External Jar" would be to add a
jar that's on your computer somewhere
. So choose that button, browse to
where simple-xml-2.4.1.jar is located
and make sure to add it to your build
path