Is it possible to browse the source of OpenJDK online? - mercurial

Is it possible to browse the source code of OpenJDK online, just like I can do with SourceForge's projects? I never used Mercury before, so I felt confused.
(Note: I don't want to download the source. I just want to browse it online, to see how some methods are implemented.)

OpenJDK is now on GitHub: https://github.com/openjdk/jdk
It is a large project, but you will find the implementations of the core classes under jdk/src/java.base/share/classes.
For instance you can find the implementation of java.util.List here.
If you need to browse older versions, you still need to use the old Mercurial interface.
The Mercurial interface there is quite confusing if you are not used to it, and since this is a large project, it can be hard to find what you are looking for.
Here is an example:
To find the JDK6 implementation java.util.List, select jdk6, jdk, select browse. Then browse to src/share/classes/java/util/List.java.
You should end up at http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/share/classes/java/util/List.java

The latest JDK 8 OpenJDK Java Class Library source code can be found here: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/tip/src/share/classes/

Here is the basic step to get latest or any released version of Openjdk 8 (or any existing java version) source code, and use them in Eclipse.
Steps:
[browse source]
Open url for jdk, e.g http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/
click tags
choose proper tag, e.g jdk8u73-b02
then click browse,
then browse into folder src/share/classes,
[download source]
then click one of bz2 / zip / gz, to download source in relevant compressed format, (e.g for jdk8u73-b02 in zip format, the url will be: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/archive/2ab13901d6f1.zip/src/share/classes/)
[use in eclipse]
uncompress it,
zip the folder "classes/", make "classes/" as the root dir of .zip file, (e.g first cd jdk-2ab13901d6f1/src/share/, then zip -r openjdk_8u73_b2_src.zip classes/)
move the created zip file to proper location, it will stay there for a while, (e.g mv openjdk_8u73_b2_src.zip /media/Eric/software/java/jdk/openjdk/openjdk8u73-b02/source/)
in eclipse, specify source file for jars of installed jre, could specify the source attachment for each jar of installed jre respectively, the most common jar is probably rt.jar,
optionally, might need refresh project to make it totally take effect, not sure is that necessary,
test it: in eclipse, ctrl + shift + t, then input Cancellable, select the sun.nio.fs.Cancellable of corresponding installed jre,
if the source code is available, then it's good, because this source is not available in jdk_home/src.zip, it must be from the additional openjdk source,
switch source back: could switch back to use "jdk_home/src.zip", if don't want to use the external openjdk source,
ok

Here's a way to browse the repositories and look at just the bits you want.
http://hg.openjdk.java.net/
Is that what you are asking?

Append a "/file" to the root URLs to view the browser like this:
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/
http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file

Grepcode.com is great for similar things - not only OpenJDK sources, with searching in classes/methods and links between classes directly in highlighted code:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/net/Socket.java

As mentioned in the other answers, the source code repository is at https://hg.openjdk.java.net
However, the OpenJDK team mirrors some of the projects on GitHub: https://github.com/openjdk
Including the latest Java version project (https://hg.openjdk.java.net/jdk/jdk): https://github.com/openjdk/jdk

Surely http://hg.openjdk.java.net is one good option. The other equally good source is zGrepCode https://zgrepcode.com/java/openjdk/ . It has both Open JDK and Oracle java versions.

Related

Install {{listen}} template on Mediawiki?

I have installed MediaWiki and I would like to use the {{listen}} template as one can do on Wikipedia.
I tried copying the {{Template:Listen}} and {{Module:Listen}} pages onto my wiki, but it doesn't give any result as the pages are interpreted as text (while {{Module:Listen}} is code (Lua?)).
What should I do to get this to work?
You need to install the extension Scribunto, to be able to use Lua. In recent MW versions, the extensions is already bundled, and all you have to do is
require_once "$IP/extensions/Scribunto/Scribunto.php";
Otherwise download it and put it in your extensions directory first.
If that doesn't work, you might have to use another version of Lua than the one bundled with the Scribuntu extension (this will depend on your server). See instructions on http://www.mediawiki.org/wiki/Extension:Scribunto on how to do this. In short: Install Lua on your server, set $wgScribuntoEngineConf['luastandalone']['luaPath'] to the path of your Lua binaries, and add $wgScribuntoDefaultEngine = 'luastandalone'; after the require_once line.

Is there a way to compare two .exes to see what differs between them?

Is there a tool / process by which I can decompile two .exes (one of which runs on a handheld device, the other which doesn't) so that I can get a glimpse into what differs/what the problem may be?
Of course, seeing that one has "00xA" where the other has "00xB" won't help me. I mean a way to see code that differs, or more likely, a compiled resource or config file difference, or some build option or so?
I'm almost positive the problem has nothing to do with code per se (if/while/switch statements, etc.) but with the project setup.
I cannot compare the working source, as it does not exist - I only have the .exe from which it came. The source I have available is a "reasonable facsimile" of it, but not exactly the same, at least not in project settings and configurations, etc.
UPDATE
Re: this page, I'm not familiar with some of the terminology; specifically, where it talks about a "FLATRELEASEDIR" - WTH?
Will this work to test my CE-bound* .exe on my PC:
Run depends.exe*
Open my CE-bound** .exe
Stare in wonder at the amazing plethora of errata and data
?
*Supposedly not to be confused with "adult diapers"
** "bound" as in, "that's where it's headed"
UPDATE 2
Here's what I see when running Dependency Walker on my app:
...but note my dilemma here.
UPDATE 3
Here's what I did to try to replicate my handheld environment on my PC as best as possible:
I wanted to just copy over the whole dad-burned thing (the entire handheld device representation from Windows Explorer), but it won't let me do that - it's not copyable, so I copied over just the "Program Files" folder (which contains the subfolder of my app and a couple of other folders which I don't know are standard or custom/peculiar to us).
This is from the handheld device where the .exe in question does run properly, so obviously (theoretically?) there should be no missing modules - Dependency Walker should run it and say all is well.
However, it doesn't; I get the same results as the one p[a,o]sted above.
Note: This is true even after selecting "Options > Configure Module Search Order... > The Application Directory > Move Up in Dependency Walker.
So since even an .exe that runs fine tests out as being "not ready for CE-time", how can I use this to accurately test which, if any, necessary files are missing?
Do I need to copy over other folders, too, or what?
UPDATE 4
So, the (supposedly?) missing modules are:
API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
DCOMP.DLL
GPSVC.DLL
IESHIMS.DLL
If true, then why does the .exe run on the handheld?
Note: Other folders on the handheld are:
Application Data => only contains "desktop.ini"
BTExplorer
My Documents => contains a "desktop.ini" and several SQLCE databases (*.SDF)
profiles => contains an empty "default" folder
Recycled => contains a single ".lnk" file
Temp => contains a handful of ".tmp" files
Windows => contains a slew of folders and files, including several .DLLs, but none of those listed above
The "Program Files" folder has a ".NET Compact Framework" subfolder, but it is empty.
In the \Windows\AppMgr folder, there are some interesting files, such as:
Microsoft .NET Compact Framework.DAT
Microsoft .NET Compact Framework.DLL
...several other DAT/DLL pairs, including:
Symbol Managed Class Libraries.DAT (no corresponding DLL)
...and even a pair:
SSCS HHS.[DAT,DLL]
-- which is our company acronym (SSCS) and name of the project (HHS)
What generates these? From where are they referenced??
Another possible piece of the puzzle is that the handheld device on which the .exe does not work does not have a \Windows\AppMgr folder, and thus does not have those .DAT/.DLL files listed above...
UPDATE 5
Another oddity:
After reading this: "Files that install in the GAC go in the\Windows directory" in the book "Microsoft .NET Compact Framework" by Andy Wiggly, et al, I tried copying the Windows folder from the handheld device to the spot on my PC below the folder named "3910ProgramFilesFolderCopy" which looks like this in Explorer:
C:
3910ProgramFilesFolderCopy
Program Files
Windows <= tried to copy the "Windows" folder from the handeld on top of "3910ProgramFilesFolderCopy" so it would end up here
...but it only copies a few files before borborygmas occurs (electronic borborygmas, that is) and it tells me, "the system cannot find the file specified"
Heavens to Murgratroid!?! Why does it find some but not all? Looking at the Windows folder on the handheld in Windows Explorer, I see that many of the precious DLLs are greyed out:
Arggh, double-arg, and (&c)
For PC you could try .NET Reflector.
http://www.red-gate.com/products/dotnet-development/reflector/
You may try to use dependency walker to undestand wich DLL/APIs they need and check if those are supported on your device.
http://geekswithblogs.net/WindowsEmbeddedCookbook/archive/2011/02/02/using-dependency-walker.aspx

Is it possible to get code-hinting in JetBrains WebStorm for a non-core node package?

Is it possible to get code-hinting in JetBrains WebStorm for a non-core node package? Specifically, I'd like to get hinting/completion working for buster. I can't seem to find any information on this. Thanks much!
For buster.js, download buster-test.js and save it somewhere the WebStorm/PyCharm project can see it. Hinting should show up immediately.
WebStorm 2020.1
There's a trick to getting "coding assistance" for 3rd party packages that support community stubs (AKA Typescript definition files):
Open the project's package.json
Position the cursor on the package (within the dependencies section)
Press alt+enter (or click the light bulb)
Choose Install '#types/name' (where name is the dependency)
For example:

Adding an external jar library to Intellij IDEA

I'm having a silly problem : I'm trying to add the Jsoup library (which is just an external jar) to my android application developed in Intellij Idea and it seems and don't do it right .
I put the library in the libs folder , then I went in Project Structure -> modules and selected dependencies , select add global library , select attach source and click ok.
When I write code it is able to automatically import classes and to compile , but when running I get " java.lang.NoClassDefFoundError: org.jsoup.Jsoup"
Copy the .jar file into your lib/ directory.
Right click the new .jar in the lefthand file browser in IntelliJ / Android Studio
Choose "Add as Library..."
Voila!
-Open the External Libraries node on the Left hand panel.
-Select Open Library Settings
-Project structure dialogue opens up.
Select the Libraries.
Click the "+" to browse the file.
![add external jar1
In IntelliJ IDEA 15 you can also access the Project Structure menu item from "File" item in the menu bar. Select Libraries from the list on the left. Click the "+" to browse the file, select it and you're done. It will be added to the "External Libraries" directory in your project.
Have a look at the newer artifacts section. Perhaps you don't add the JAR into your deployment properly.
UPDATE:
I'd like to update my answer based on lessons learned over the past six years since I first answered this question.
The best way to manage 3rd party JAR dependencies in Java projects is to learn Maven (my preference) or Gradle. IntelliJ has terrific integration with both.
If you combine those with an enterprise repository like Nexus you'll have no problems. Your dependencies and versions will be completely specified. Conflicts will be identified for you. Updates will be relatively simple.

How do I build libmySQL?

I aim to integrate libmySQL into my executable instead of using libmySQL.dll.
I use VC++ 2008 # Windows Vista.
I've downloaded "mysql-connector-c-noinstall-6.0.2-win32-vs2005.zip" from
http://dev.mysql.com/downloads/connector/c/
It contains only ".h" files with declarations. Where is the implementation code (".c" files)?
As said, I wish to be able to manipulate the code, build it as a static library (".lib") and finally integrate it into my exe.
How do I do that? Am I looking at the wrong place? Is it available at all? And if/once I do get it, does it require any special compilation? What are the steps?
you should find a .lib inside, .h .lib and .dll are enough to link it to your app
ora select 'source code' as platform instead