Where to find source code for java.lang native methods? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm vaguely familiar with the JNI, and I'm curious to see my machine-specific implementation for some native methods in the java.lang package. Thread#currentThread(), for example.
I've found a bunch of DLLs in [JDK_HOME]/jre/bin, but like I said I'm trying to find the source code.
Does anyone know where the native source code can be found? Is it even available, or is it classified by Sun (oops I mean "We're In It To Win It" Oracle)?

For JDK6 you can download the source from java.net. For java.lang the story begins at j2se/src/share/native/java/lang/, and then search... JDK7 rearranges the directory structure a little.
Some methods, such as Object.hashCode, may be implemented by hotspot instead or in addition to through JNI/Java.
JDK6 is freely licensed through the Java Research License (JRL) and Java Internal Use License (JIUL). JDK7 and OpenJDK6 is licensed under GPL 2 with CLASSPATH exception (roughly speaking you can link to it without catching the GNU virus). I am not a lawyer.
(BTW: The real lawyers would like to point out that I am still an employee of Sun Microsystems. Sun UK is no more. It is now Oracle.)
Update (Adding location for Thread.c):
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/Thread.c

You can look at the source code for OpenJDK (licensed under GPLv2 with Classpath Exception). Probably the best way to study the JDK implementation internals, unless you want to be bound by the Java Research Licence, in which case you can access the actual JDK 6 source.

Related

Why the JDK source code(src.zip) doesn't include all the class in runtime jar(rt.jar) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
All, I just wondered how can I get the source of the rt.jar for JDK 1.7. I knew there is a source package name the src.zip under the JDK home path(supposed in the windows system). But it seems some classes of rt.jar is not included in it. Like sun.misc namespace. Did I miss something? Thanks.
Update
I just want to debug the source code of ConcurrentHashMap. I already compiled source from JDK src.zip and added into the endorsed folder. But found sun.misc.Unsafe still missing.
"But often you end up in Java class libraries, where there is debug information attached in the class files (at least those shipped with the JDK) but no source is present in src.zip. Official statement is that src.zip only contains publicly documented classes (i. e. the same ones that are covered by the official Javadoc)" I found this here. Seems like a possible explanation.
And I found the same discussion on stackoverflow and someone stated "sun.* sources are a part of JDK that is proprietary closed source Sun code (or Oracle since 2010).". And here the link again.
You can get it via the Java Community Source Code Program.

Free java swing datepicker [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Is there any free datepicker exist for java in swing. I look through the following pickers such as jdatepicker jxdatepicker and Jcalendar. But all are licensed under BSD, LGPL and LGPL respectively.
From the sounds of it you are looking for free code that can legally be taken closed-source, NOT specifically open source code.
Open source means just that - the source is open. It doesn't explicitly mean it can't be made closed source. The licence of the software specifies what can be done with the software in question. The GPL, for example, requires that derivative code must be open source.
As it happens, the LGPL licence - also known as the "lesser" GPL - is one of the licences that allows code under its licence to be released commercially without requiring that its derivatives are made open source as well. Similarly, the BSD licence also permits closed-sourced derivatives
More reading:
Permissive Licences
GPL and LGPL open source licensing restrictions
SmashingMag on OSS Licences

Is There A Portable Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
i was just wondering if anyone knew of a portable java IDE/Compiler? Something like an iPod but not so advanced, that let's you work with and compile java?
Just thought it would be a cool idea :P
This serves the purpose. We can compile the programs without requiring Java compiler on our machine.
There is an IDE for Android which supports this, see AIDE
Search for drJava. Is a pretty complex editor and includes a(n Eclipse) compiler.
Unfortunatelly, the project seems to be dead.
If you have an iOS device (iPhone, iPod touch or iPad) at hand, you can jailbreak it and install Java from Cydia. This gives you the compiler and the VM. However, it's old and limited to command line functionality.
You can use http://ideone.com/. This is a website for compiling and running java applications Here you can create an account and save all your example programs, which you can later refer from different location or even share it with others.
You can also practice other computer languages in it. It supports more than 40 programming languages.
Have you given any thought about using codenameone platform? http://www.codenameone.com/

Where can I find the OFFICIAL Java Coding/Style Standards? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I use CheckStyle plugin for Eclipse and it does a wonderful job. I would like to know if there an official Code/Style standard (and there should be!) out there by Sun/Oracle... The ones I am finding are so out-dated, they don't even include any Java 1.6 specific syntax, etc...
Here is what I found so far:
http://developers.sun.com/sunstudio/products/archive/whitepapers/java-style.pdf (last modified 2000)
http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html (last modified 1999 - CheckStyle website references this)
I understand that to a degree most of the Java syntax has not changed much but you'd think it wouldn't be over 10 years old!!! Any ideas where to find an updated version or if there is any that I am just not finding?
Thanks
Try looking at the -Xlint compiler flag for javac for a programmatic check (if that's your question). It checks most things for you.
Also, what's wrong with having a code style document that's > 10 years old? That means the language is fairly stable and older code looks much like newer code, making maintenance easier. The library may have expanded but much of the syntax is identical. Your second link is what my searches returned and seems very comprehensive.
EDIT: If you want the nitty gritty details on the new Java syntax, check out the Java Specifications.
To the best of my knowledge the internal Sun coding stds document was never officially updated to include conventions to encompass language changes such as Generics, Annotations, or now (in JDK 8) Lambdas etc.
I personally have always used the empirical style derived from the JDK itself, i.e if my code doesn't look like JDK code, then I am not following the coding practice.
The links above are broken now since Oracle reorganized their web site.
http://web.archive.org/web/20090911103851/http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

Need modbus Java library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I need simple modbus Java library with source code. I found on google but there is .jar file and doesn't have strong using manual. Can anybody suggest me modbus library with using manual or source code ?
You can try Jamod. I never used it, but a colleague of mine used it sometime ago and he was pleased with it.
Try this one:
http://sourceforge.net/projects/jamod/files/jamod/1.2/
By the way, you can use JDGUI to see the sources of any jar file.
FieldKit is paid and open source, and haves support for several languages including Java
jModbus Project
j2mod is a fork of jamod
If you are using Modbus RTU (Serial) Java Communications API is needed; stolen from FieldKit documentation:
The Java Communication API is available from different sources:
Sun Microsystems is publishing versions for the Solaris and the Windows platform at http://java.sun.com/products/javacomm/.
Keane Jarvi publishes a LGPL licensed Linux and cross-platform COMM API at http://www.rxtx.org/.
An excellently performing package for a large variety of platforms is the SerialPort package from Solutions Consulting at http://www.serialio.com. Using this package, poll cycles of less than 10 ms can be achieved!
Perhaps jSSC is a good javax.comm implementation too.
There is another one recent solution modbus4j.

Categories