I have added the Javax.mail library to my project, and added the jar files as Libraries and included the dependencies as well but still it displays "Sources not found" in the Javax.mail classes and wants me to attach sources. Help Plz
I'm not using Maven
When you add a library to IntelliJ IDEA, at a minimum you need to attach the JAR (or directory) containing the compiled classes (i.e. the binaries). You then can optionally add either the source code, the javadoc, or both. Javadoc can be added as a JAR file, a ZIP file, a directory, or as a URL. Source code can be added via a JAR file, a ZIP file, or a directory.
Adding either the Javadoc or the source file will allow you to see the libraries Javadoc documentation via the "View Quick Documentation" action (Ctrl+Q / ⌃J or View > Quick Documentation from the menu). Since the source code has the Javadoc source, IDEA can pull the Javadoc from it.
An additional added advantage of having the source code attached is that you can actually view the source code (via various actions like quick definition lookup Ctrl+Shift+I / ⌥Space or via the view menu, or the go to implementation or declaration actions).
With third party libraries, not all of them will have Javadoc and/or source code available. Some will have one or the other, some both, and some neither. Sometimes,you have to go hunting for the source code or Javadoc. The two best places to look are the project's home page and the Maven Central Repository (http://search.maven.org/). Even if you are not using maven to build your project, you can find and download binary, source, and javadoc for a lot of projects/libraries there making it a good resource.
If you go the the Maven Central, and do a search for javax mail, in the search results listing will be the javax.mail library. If you click the all link for it, you will get a listing of all the versions of the javax mail API available in maven central. Some have Javadoc and sources available (especially the most recent ones), some only sources, and some neither (mostly older releases).
So in this case, we can find the source, download it, and attach it. However, in some cases you will not be able to. Especially for propitiatory (i.e. non-open-source) software that does not release the source. That's OK. You simple loose the functionality to be able to view the source of a class. You know that and can ignore the warning.
Related
I want to run adempiere customization with webui from eclipse using webtool and tomcat server, so i can run and debug code more efficiently for webui customziation.
These thing i have tried in adempiere trunk by using following link :-
http://www.adempiere.com/Creating_WebUI_Workspace_using_Eclipse_Webtool
,but for this i can not do in customization. As i build trunk project using utils_dev/build.xml after that it created webui.war which showing while adding project in server. As for customization given directory were not available i have copied that in customization and try to build it it's not working and showing a lot of files not found. As i think that's not correct way because many of files will not be there in customization.
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
Secondly i have tried one another link :- https://github.com/adempiere/Customization-Template, in which it showing i have to customize ant build.xml files. As the project is available to me i referred the build.xml files also created build.xml files in client,base and zkwebui folder. But while executing that xml file it showing following error message. I think it's related issue with deprecation, but i am confused in this i will get proper output or not.Any one please suggest me how can i accomplish this things.
The given link http://www.adempiere.com/Creating_WebUI_Workspace_using_Eclipse_Webtool worked successfully for adempiere trunk project but that's not worked for customization. Can any one suggest me how can i accomplish same for customization
Second link i have followed :- https://github.com/adempiere/Customization-Template the same process i followed which i mentioned above.
Check the online book section on development environments. This may be a copy of what you were reading in the wiki. (Note, the wiki has moved to wiki.adempiere.net).
To create customizations in ZK, you'll need to create a file zkcustomization.jar and add it to the install ADEMPIERE_HOME/lib directory (not the eclipse project) before you RUN_Setup/RUN_SilentSetup to build. Any class you add to this jar will override the equivalent class in the main project.
From Eclipse, you can modify the main project directly and debug it normally but you will need to keep track of the classes you modified and add them to the jar file manually. This is a bit tedious.
The template approach is useful when you have many customized classes and need to ensure you get the jar file correct. It allows you select or add the specific java files you require and modify them while keeping the core project untouched. It suffers from the lack of a "hot-swap" feature which is so useful in the SWING interface and also that the web deployment doesn't span projects. For this reason, when debugging the customized ZK interface, the template needs to copy all the compiled classes from the main project in order to deploy the web server. There are ANT configurations/scripts to help with this but they may need some tweaking as the main project is updated. Also, the template needs access to the correct libraries so you may have to update the build configuration as you add customizations. Once you can run the adempiere zk interface from the template, you can create the zkcustomization.jar file automatically. Then be sure to add it to your deployment package.
Its a bit of a hassle getting the template configured but it works quite well once you have it set up.
I have recently started using Sightly in AEM 6.1, which allows the Java files to be located in the same folder as the component and use the WCMUse class. However, I am noticing that whenever I do a Maven build that involves a change to one of those Java files that the page functionality operates as if the Java class had not been changed, though the Java file in the crx does include the changes. As a workaround I have been been able to modify the Java file in the crx, save it, then modify it back and save again in order to update the functionality, but I do not have that capability on all of my instances.
Anybody have an idea how to force the recompile of the Sightly Java within the components either during or following the build?
A few things to validate:
1- Do you change the version of the software when doing a maven build/deploy? Sometime if your zip or jar does not have -SNAPSHOT in it AEM won't update the code when maven deploys.
2- there a /var/classes/sightly in CRX/DE that you can delete compiled classes, I think even in the system console there is an entry
Hope this help.
Bambara actually helped me get to the answer that I needed. It turns out the /var/classes folder holds the compiled sightly files, but it doesn't naturally recompile on build. Deleting that folder on build, then running a page that uses the sightly code forces a recompile and shows the new functionality.
Hopefully others can answer why this happens and how to avoid it. Having faced this a number of times, I'm beginning to think placing Java code into the component folders is not a very good idea. Using a maven multi-module project with a Services/Core bundle, then all Java code could go there. Calling it from the view just requires using the fully qualified classname (including the package). Placing the Java into the services bundle has the following benefits
Allows the classes to be extended. For some reason compilation was unpredictable when extending classes from component folders.
Easier IDE setup. Java classes in component folders in the view module have a Sling specific folder structure, so getting IDE's to provide code assist requires extra effort.
Sling folder conventions follow URI practices and might have dashes, Java packages cannot have dashes... import apps.my-cool-project.components.pages.base.Header; // won't compile
I'm in the process of writing a small Java library that contains a related code that I usually include in most of my android app. I decided to export the library as a jar file then drop the file in the libs folder of my future projects.
Using Android Studio:
I created a Java Library module and put my code in it. And I added some comments to some of the method, following this.
Then, I ran the jar task in gradle, which gave me the .jar file in build/libs directory of my module.
Now, when I used this jar in one of my android apps, Everything works as expected, except the Doc part. When I hover over the classes and methods of my library, I don't see the Doc comments that I wrote.
Q1: Am I missing another step?
Q2: Are jar files supposed to have no comments?
The javadocs are the documents that are generated from the javadoc comments in your source code. They are not part of a normal JAR file because that would unnecessarily bloat the JAR files ... with stuff that someone running to code doesn't need.
The javadocs can be generated by a Gradle task, by the javadoc command (if you have a Java SDK installed) and by various other tools. You can then read them using a web browser.
On the other hand, IDEs can often render the javadoc comments in source code and display them as pop-ups, etcetera. (Some people would call this "javadocs", but I think that is an overstatement, since you typically can't navigate the documentation ... like you can with read javadoc documents.)
In order to render the javadoc comments, the IDE needs the source code. JAR files don't (normally) contain any source code or javadocs. Instead, the normal way to deal with this is to tell the IDE where the source code is, either by pointing it at a source code directory, a ZIP file containing source code, or URL for downloading the source code.
(I don't use Android Studio, so I can tell you exactly how to do this. However, I imagine that the IDE's online help explains how to do it ...)
It seems that your end goal here is to distribute your libraries in a way that allows programmers to see the javadoc comments.
The simple way to do that is to distribute source code. This Q&A describes how to get Gradle to generate a separate archive containing the source code, or add the source code to the JAR containing your compiled code1.
If that isn't acceptable, you may need to generate the javadocs as HTML2 and provide the HTML tree as a separate ZIP file that a programmer can unzip and read with a web browser. Alternatively, put the javadocs up on a website.
1 - I would not recommend this. People who just want to use the JAR as a binary are liable to complain about "bloat".
2 - If neither providing source code or javadoc HTML documentation is acceptable, I don't think there is a pragmatic solution.
There is a separate Gradle task to generate javadoc. Try adding the following:
task javadocJar(type: Jar, dependsOn:javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir }
And then run:
gradle javadocJar
See if that helps.
In addition to the above, you can try and add the following to make to generate a single jar with both compiled classes and javadoc:
jar {
from javadoc.destinationDir
}
jar.dependsOn javadoc
I don't know if that's the right decision to bundle everything in the same jar. I prefer keeping the jars separate and maybe find another way to make the IDE use the javadoc jar file. Maybe try adding the javadoc jar as another dependency of the module.
Yes This is possible
Hi, This is possible but with a small change like in the jar file.
First of all, from a code point of view jar file contains only compiled ".class" files and not source files ".java"
So if you need a doc to be applied with a jar by this I mean not the index.html which gets created but the comment that appears whenever a person uses the jar API and calls a method with a suggestion.
Example :
For that, we need to also add a source file while generating .jar file.
Steps for the same:
Type comments/java docs in code
Generate Docs
This will create a doc folder in project folder
Now create jar file
Make sure you choose this option as shown below
Almost done just test it by importing jar to another project and it should the suggestions as per docs
Very Important this can be harmful as you are including source files.java in your jar so before making make sure if you need this or not.!!!!
Hope this gave your answer
Any questions you can contact me over: VaibhavMojidra.com
I have a project that uses servlet-api.jar. When debugging, I wanted to step
into its classes (such as HttpServlet), but I got "Source not found attach source ".
Is there a way to get the source like all the Java sources? It would be good to have so I would be able to debug it and to step into the code.
You can get apache source code from the apache tomcat website: http://tomcat.apache.org/index.html
The Servlet API JAR is just interfaces (along with a few minor utility classes); there's nothing to step into.
Depending on your app-server, you can download source for implementation classes like HttpRequest (for Tomcat, instructions are here). However, why do you feel there would be value stepping into those classes? They generally work well, and any problems are almost certainly in your own code.
In addition if you are in eclipse or netbeans, and are using maven based project right click on the dependencies and download sources for your particular dependency.
You can get the source from java2s.com
(version 3.0 of the servlet API): http://www.java2s.com/Code/Jar/s/Downloadservletapi3020100224sourcesjar.htm
(or the older version 2)
http://www.java2s.com/Code/Jar/s/Downloadservletapi256114sourcesjar.htm
In fact java2s.com is a huge java source, program & jars resource.
Intellij IDEA
Download source codes from Apache, put somewhere at some stable place in your computer.
Try to go into some .jar function until "decompiled" result shows.
Click "Choose sources".
Select downloaded source codes and IDEA will do the rest :)
To checkout the Javadoc on the classes or methods of "servlet-api.jar",
visit
http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.27/src/
(for other versions of tomcat visit -
http://archive.apache.org/dist/tomcat/tomcat-8/
and navigate to their "src" directory,
and download zip file for Windows(tar for Linux.) and finally
attach it within the IDE(Netbeans, Eclipse, etc.)
When you download the binary distribution of the apache tomcat, you can also download the corresponding source code distribution(on the same page).
Simply download the source code distribution zip.
move it to somewhere inside tomcat apache folder
Point to source code distribution zip when Eclipse asks you for the source code attachment.
I'm trying to create a SWT application in eclipse. I've followed the instructions and loaded the org.eclipse.swt project to my workspace, and made it a dependency of my project by adding it to my build path.
However i cannot see the javadoc when i'm referencing the SWT libraries. I tried extracting the 'src.zip' into the org.eclipse.swt project, and then tried generating the Javadoc which created a 'doc' folder with a whole bunch of html files, so i think it's all there, it's just that eclipse isn't picking it up.
Can someone suggest anything please?
You shouldn't need to generate anything to get the Javadoc.
See if you can edit your SWT build classpath entry and attach the src.zip there. That should be enough to display the associated javadoc (like in this tutorial, except you can reference an external file src.zip instead of the external 'src' directory).
You shouldn't need to extract the zip or generate the Javadoc. I assume you followed the instructions listed here:
Developing SWT applications using Eclipse
I followed the same steps and was able to view the Javadocs in the Javadoc view tab. The tab is automatically updated whenever you click on a class you are instantiating in your code.