I just ran into a problem with the version of JAX-WS in JDK 1.6.0 being different than the one in JDK 1.6.0_14.
I've been searching around for a list of the various libraries that are packaged in the JDK that shows the versions of the library included in the version of the JDK.
I haven't had any luck yet.
Is there such a list?
Usually this information can be found by digging around in the JavaDocs for the release (not the API docs, but the release notes and spec notes (e.g. for Java 6 ). It's in there somewhere, but sometimes that kind of info is tricky to find.
It is probably in JSR 270 (http://jcp.org/en/jsr/detail?id=270) which defines exactly what is Java6. But I havent checked and JSR are not the most pleasant readings ;-)
Have you tried looking inside the jar file?
In the META-INF folder is a file called manifest.xml which might contain version information. Some vendors do this (e.g. Oracle's JDBC driver has this), but some don't.
Related
I have a trial task which includes writing simple http server using only Oracle JRE 1.6 standard libraries. Here simple HTTP server in Java using only Java SE API
I found the statement:
Since Java 1.6, there's a builtin HTTP server in Sun Oracle JDK (note: JDK, not JRE).
But I thought that all runtime libraries are included in JRE, and JDK is JRE + some development tools. Also, I have downloaded JRE 1.6 and found that HttpServer is included there in the rt.jar file.
So, my questions are:
Is it correct for me to use this implementation?
Why it is stated that JDK has libraries that are not in JRE? Do JDK provide any additional libraries to JRE?
Before I answer, please note that I am not familiar with the implementation you're referring to (I generally pull in Jetty and embed it when I need an HTTP server in my modules). So I'll answer somewhat generally, but maybe this gets your mind thinking in a direction that's helpful.
Is it correct for me to use this implementation?
That depends on the constraints on the trial task. Assuming that the implementation meets those constraints, and you are willing to live with any shortcomings it has, then there is nothing intrinsically wrong with using it. If it's available, it's fair game.
Why it is stated that JDK has libraries that are not in JRE? Do JDK provide any additional libraries to JRE?
First off, the statement made in that question is observably false. Clearly that implementation is included in the JRE.
More generally though, the JDK always has the option to do this, and there are definitely libraries deployed with a JDK that are not deployed with a JRE (see this page). Moreover, depending on the install, it's possible that there are installed extensions to the JRE in place (see this page).
In the documentation for batik, it shows how to get an instance of the DOM implementation from the class org.apache.batik.dom.svg.SVGDOMImplementation.
However, after downloading Batik 1.8 from the same site, I cannot find this class anywhere.
I downloaded the 1.7 version and found it in batik-svg-dom.jar but it does not exist in the same jar within 1.8 (or as far as I can tell in any of the jars in that package).
Has this class been renamed / refactored / replaced? If so how do you get an instance of the DOM implementation in batik 1.8?
I found the answer, embedded in the maillist thread posted in #Ajay's answer.
It seems that in order to solve this bug, they have moved SVGDOMImplementation into package org.apache.batik.anim.dom, which lives in the jar file batik-anim-1.8.jar.
As at the time of writing, the batik web site had not yet been updated, and for some reason this change was also not highlighted in the release notes.
I'm having same issue, looks like we need to drop back to 1.7.. 1.8 is unstable as suggested in of the thread
http://mail-archives.apache.org/mod_mbox/xmlgraphics-batik-users/201503.mbox/%3C5515BC93.90402#ptc.com%3E
I had the same issue with Apache Batik 1.8. The official binaries of that version are not compatible. To get the version 1.8 work I had to replace fop-transcoder-allinone-1.1.jar by fop-transcoder-allinone-2.2.jar which I took from Apache Batik 1.9.
Download binary of Apache Batik1.8 it makes life easier with above problem. Include only that in your project. That's enough. Here is the link.
Note that binaries are nothing but source code compiled into Java Archive files (JARs) they are the one's that execute on JVM.
I found a java code and want to use it in my project. It contains these imports that my JDK does not have :
import com.sun.awt.AWTUtilities;
import com.sun.jna.Native;
import com.sun.jna.platform.WindowUtils;
I referred to sun site and found this download page :
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Is it necessary to download all JDK and JRE and replace it from SUN website? My JDK is version 6 and is up to date.
Thank you all
JNA is an additional library and not part of the standard api, you have to download it (here) and include it in your classpath.
The AWTUtilities class is only distributed with the sun jvm as an implementation detail of the api and as such subject to change, this can break any program depending on it (if possible don't use it).
WindowUtils can be found in the platform.jar, you it can find it on the same page as jna.
Your JDK should have com.sun.awt.AWTUtilities. It is in rt.jar.
Maybe the problem (for that file) is that your IDE excludes the parent the build path ... on the grounds that it is a bad idea to use those classes directly.
The com.sun.jna classes are not in rt.jar. They apparently may be found in a jna.jar, though I haven't yet found a good place to download it from. (If you use Maven, try this.)
You should not use any com.sun packages except as a last resort. These are considered to be implementation details, and they are not part of the JDK API. They can change arbitrarily between versions, so they can cause problems when you try to upgrade JDK versions.
The com.sun classes are almost always wrapped by "official" classes - you should use those instead. You can use these in a last resort situation, but they are already part of the JDK download, so there should be no extra downloading necessary.
EDIT: Looks like you're right, you do need to download some extra jars. The JNA jar is available on maven central (http://mvnrepository.com/artifact/com.sun.jna/jna/3.0.9). Especially if this is a code snippet you found, I would highly advise against using com.sun packages directly.
Where can I find the source code for the Java library classes? I mean classes in rt.jar.
Platform: Windows.
For old versions of Java with separate JRE and JDK downloads, download the JDK. The sources for the public classes are in src.zip.
Here's the browsable source code for OpenJDK 7.
Update: As of June 2018 grepcode seems to be down. Here you can find an alternative.
Update^2: As of October 2020, the two previous links do not work. View it at OpenJDK and vote up the answer by Nosrep, which I got it from.
Sources are in src.zip located in the installation folder:
On Windows, the JDK includes src.zip by default if I remember well.
On a Linux distro, you may have to install the sun-java6-source package.
On Mac, you'll have to download the Developer Documentation. Have a look at this answer.
If you only need to have a look at the source/implemenation, i would suggest using
Docjar
Edit
GrepCode is even better
GrepCode
You can directly browse the code online here for Java : https://zgrepcode.com/java/openjdk/10.0.2/
It is a great tool also for browsing most of the open source projects as it gives you internal linking to classes.
As almost all the suggestions seem to be either grepcode or zgrepcode which are both down, I found one from OpenJDK here: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/
Edit: a more complete version of all OpenJDK projects and JDK 6-15 can be found here: https://hg.openjdk.java.net/
As mention above, most of the source files can be found by downloading the SDK.
However for some classes you can find the source code (javax.ssl etc') for I suggest adding the jad eclipse plugin that will decompile any class without using external site such as Docjar.
Jad eclipse info:
http://jadclipse.sourceforge.net/wiki/index.php/Main_Page
There is also grepcode.com (not sure how old this site is, perhaps this answer is an update for new solutions now), sample query:
http://grepcode.com/search?query=java.lang.Math.sin&start=0&entity=type&n=
Where can I download the JSSE and JCE source code for the latest release of Java? The source build available at https://jdk6.dev.java.net/ does not include the javax.crypto (JCE) packages nor the com.sun.net.ssl.internal (JSSE) packages.
Not being able to debug these classes makes solving SSL issues incredibly difficult.
there: openjdk javax.net in the security group
src/share/classes/javax/net
src/share/classes/com/sun/net/ssl
src/share/classes/sun/security/ssl
src/share/classes/sun/net/www/protocol/https
also on this page:
src/share/classes/javax/crypto
src/share/classes/com/sun/crypto/provider
src/share/classes/sun/security/pkcs11
src/share/classes/sun/security/mscapi
These directories contain the core
cryptography framework and three
providers (SunJCE, SunPKCS11,
SunMSCAPI). SunJCE contains Java
implementations of many popular
algorithms, and the latter two
libraries allow calls made through the
standard Java cryptography APIs to be
routed into their respective native
libraries.
I downloaded the src jar from: http://download.java.net/jdk6/source/
NOTE:
This is a self extracting jar, so just linking to it won't work.
... and jar -xvf <filename> won't work either.
You need to: java -jar <filename>
cheers,
jer
if you just want read the source code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/security/ssl/SSLSocketImpl.java
While this doesn't directly answer your question, using the javax.net.debug system property has helped me sort through SSL issues. -Djavax.net.debug=all pretty much gives you everything in gory detail. Documentation on this is at JSSE Debugging Utilities.
One note: I've seen that on Java 1.4 and maybe 1.5 levels, the output with option "all" is not as complete as it is using the same option on the Java 1.6 level. E.g., 1.6 shows the actual contents of network (socket) reads and writes. Maybe some levels of 1.4 and 1.5 do as well, but 1.6 was more consistent.
For some unknown reason Orcale doesn't released source.jar and javadocs jar for JSE.
I found only one place where you can find them http://jdk7src.sourceforge.net/ but it's outdated and unofficial.
The only one way is to clone OpenJDK repository
Put Jad on your system path. Install JadClipse plugin for Eclipse. Use the force, read the decompiled source. :-)