I've been trying to set up on JavaFX in VSCode. I added the JavaFX jar files to the referenced libraries and added the following statement to launch.json (obviously with my path to the lib folder):
"vmArgs": "--module-path \"C:/path/to/javafx-sdk-19/lib\" --add-modules javafx.controls,javafx.fxml"
This is exactly what multiple youtube videos and other StackOverflow posts have said to do, but I still keep getting this error.
(I know that I can use Maven or Gradle in VScode but am completely unfamiliar with both and still want to try to make this work.)
Hopefully I didn't miss anything painfully obvious but thank you for any help.
You should download JavaFX for your JDK version.
Uncompress JavaFX.zip and move bin folder to your project.
You should create two classes, one for writing the JavaFX window code and one for running it.
The error can be fixed.
I suggest you learn how to use Maven or Gradle in vscode. It is very important.
At runtime, your app needs access to the JavaFX (OpenJFX) libraries.
Either:
Install a copy of the OpenJFX libraries with your app, as directed in the Answer by RedSnack-BCS.
Replace your Java implementation with one that includes the OpenJFX libraries.
I know of two such implementations of Java (JDKs) that include necessary libraries:
ZuluFX, a special edition of their Zulu product, by Azul Systems.
LibericaFX, a special edition of their Liberica product, by BellSoft.
You may have identified a third approach with the use of passing arguments to the JVM. But I am not familiar with that solution.
I'm new to the Jni environment and I want to cross compile the shared library builds using the docker so the Jar can be packed easily from any platform and can include the required shared libraries.
I had more attempts to do via CMake and Meson build system but never succeed in them, so I shifted to docker, luckily I found a repo (dockcross) which provide prebuilt images for cross compiling C/C++ toolchains.
Since the toolchains are for the windows I would have no problems when compiling with that toolchain, platform-dependent code (like long which is 32 bit in windows) should be compiled and linked through the cross-compiler and platform dependent libraries will build fine.
So, I only need the Jni headers to build. The problem is I couldn't install the Windows JDK in Linux environment, so I am not able to get the header files (jdk/include/win32).
How shall I proceed getting the header files for the build?
Found OpenJDK headers in the github repository.
Although that's not properly arranged as one in the JDK installation, its worth hardcoding those paths or use a simple bash/python script :)
Hopefully its helpful. Since its nowhere written or guided to be used. Many blog posts just download extract the whole jdk for all three OS, and then put them on their repo, which probably isn't be best idea because those headers are licensed as GPL2 and any OSS having non-GPL2 licenses (like MIT) may suffer to not do such things.
But alright, we found it so we can remotely use them as a dependency on any OSS projects!
When writing Java code, I refer extensively to the Javadoc—that is, the Java® Platform, Standard Edition & Java Development Kit Version x API Specification. I know how to read it online from the website, but I would like to download a copy to my computer so that I can read it offline when no Internet connection is available.
How can I download the documentation? Is there a way to "download" the Javadoc (JDK documentation) from an online site to a local file?
The online docs I am using tend to reject clients such as Eclipse, making work difficult, so I need to pull them onto my machine and attach them to my library JAR.
Links to JDK documentation
Java SE
Download
Web
Other
21 (Early-Access)
Not yet available
Javadoc
Project page
20 (Early-Access)
Not yet available
Javadoc
Project page
19 (current) 🟢
Downloads page
Javadoc
Doc home
18
Downloads page
Javadoc
Doc home
17 (LTS)
Downloads page
Javadoc
Doc home
16
no longer available
Javadoc
Doc home
15
no longer available
Javadoc
Doc home
14
no longer available
Javadoc
Doc home
13
no longer available
Javadoc
Doc home
12
no longer available
Javadoc
Doc home
11 (LTS)
Downloads page
Javadoc
Doc home
10
no longer available
Javadoc
Doc home
9
no longer available
Javadoc
Doc home
8 (LTS)
Downloads page
Javadoc
Platform homeDoc home
7
no longer available
Javadoc
Doc home
6
no longer available
Javadoc
Doc home
Also of interest:
Release Notes
History of Java SE versions
First, make sure they don't already offer an download in zip form or similar.
Then, make sure you are actually allowed to do this (this may depend on where you live, and on any conditions mentioned on the web site from where you want to pull this).
Then, have a look at the Wget tool. It is part of the GNU system, thus included in many Linux distributions, but also available for Windows and Mac, I suppose.
Something like this works for me:
wget --no-parent --recursive --level inf --page-requisites --wait=1 \
https://epaul.github.io/jsch-documentation/simple.javadoc/
(without the line break; it should be escaped by the \ backslash here).
Look up what each option does in the manual before trying this.
If you want to do this repeatedly, look into the --mirror option.
For downloading other websites, --convert-links might also be useful, but I found that is not needed for Javadocs, which usually have the correct absolute and relative links.
This downloads lots of the same copy of the index.html file with appended ?... names (for the FRAMES links on each page). You can remove these files after downloading by adding the --reject 'index.html\?*' option, but they still will be downloaded first (and checked for recursive links). I did not yet find out how to avoid downloading them at all. (See this related question on Server Fault.)
Maybe adding the right recursion level would help here (I didn't try).
After downloading, you might want to zip the resulting directory to take less disk space. Use the zip tool of your choice for this.
For any Javadoc (not just the ones available for download) you can use the DownThemAll addon for Firefox with a suitable renaming mask, for example:
*subdirs*/*name*.*ext*
https://www.downthemall.org/main/install-it/downthemall-3-0-7/
It's possible to use some older versions of the DownThemAll add-on with Pale Moon browser.
You can use something called Dash: Offline API Documentation for Mac. For Windows and Linux you have an alternative called Zeal.
Both of them are very similar. And you can get offline documentation for most of the APIs out there like Java, Android, Angular, HTML5, etc. ... almost everything.
I have also written a post on How to install Zeal on Ubuntu 14.04
update 2019-09-29: Java version 11
The technique below does not now work with Java 11, and probably higher versions: there is no way of ignoring multiple "broken links" (i.e. to other classes, other APIs). Solution: keep your javadoc executable file (or javadoc.exe) from Java version 8
There are good reasons for making your own local javadocs, and it's not particularly difficult!
First you need the source. At the time of writing the Java 8 JDK comes with a zip file called src.zip. Sometimes, for unexplained reasons, Oracle don't always include the source. So for some older versions (and who knows about the future) you have to get hold of the Java source in another way. It's worth also being aware that, in the past, Oracle have sometimes included the source with the Linux version of the JDK, but not with the Windows one.
I just unzipped this file... the top directories are "com", "java", "javax", "launcher" and "org". Directory launcher contains no files to document.
You can generate the javadocs very very simply from any or all of these by CD'ing at the command prompt/terminal to the directory ...\src. Then go
javadoc -d docs -Xmaxwarns 10 -Xmaxerrs 10 -Xdoclint:none -sourcepath . -subpackages java:javax:org:com
NB note that there is a "." after -sourcepath
Simple as that. Generating your own javadocs also has 2 huge advantages
you know they are precisely the right javadocs for the JDK (or any exernal jar file) you are using on your system
once you get into the habit, reconstituting
your Javadocs is not a tiresome challenge (i.e. where to go looking for them). For example I just unzipped a couple of source jars whose packages are closely coupled, so their sources were in effect "merged" & then made a single Javadoc from them...
NB Swing is semi-officially DEAD. We should all be switching to JavaFX, which is helpfully bundled with Java 8 JDK, but in its own source file, javafx-src.zip.
Unzipped, this reveals 3 "root" packages: com, javafx and netscape (wha'?). These should be manually moved over the to appropriate places under the unzipped src directory (including the JavaFX com.sun packages under the Java com.sun strcture). Compiling all these Javadoc files took my machine a non-negligible time. I'd expect to see all the JavaFX source classes in with all the other source classes some time soon.
BTW, the same thinking applies to documenting any and all Java jars (with source) which you use. However, all versions of most jars will be found with their documentation available for download at Maven Central http://search.maven.org...
PS afterthought: using Eclipse and the "Gradle STS" plugin: the "New Gradle STS Project" wizard will create a gradle.build file containing the line
include plugin: 'eclipse'
This magically downloads the source jar with the executable jar (under GRADLE_HOME) when you go
./gradlew build
[addendum 2020-01-13: if you have chosen not to include the Eclipse plugin in your build.gradle, it would appear that you can go (with the selection on your project in the Project Explorer) Right-click Gradle --> Refresh Gradle Project to get Eclipse to download the source files.]
... giving you an extra degree of certainty that you have got the right src and therefore the right javadoc for the dependency in question.
I have used Javadoc packaged by Allimant since I was in college.
The Javadoc is in the CHM format (standard Windows help format), so it's the best viewed when you're using Windows.
For the download of latest Java documentation (JDK 8u77) API
Navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html
Under Addition Resources and Under Java SE 8 Documentation,
click the Download button.
Under Java SE Development Kit 8 Documentation → Java SE Development Kit 8u77 Documentation.
Accept the License Agreement and click on the download ZIP file.
Unzip the downloaded file
Start the API documentation from jdk-8u77-docs-all\docs\api\index.html
For the other Java versions API download, follow the following steps.
Navigate to http://docs.oracle.com/javase/
From Release dropdown, select either of Java SE 7/6/5.
In corresponding Java SE page and under Downloads left side menu,
click JDK 7/6/5 Documentation or Java SE Documentation.
Now on the next page, select the appropriate Java SE Development Kit 7uXX Documentation.
Accept License Agreement and click on Download ZIP file.
Unzip the file and start the API documentation from
jdk-7uXX-docs-all\docs\api\index.html.
In this case ... make your own javadocs!
First you need the source. At the time of writing the Java 8 JDK comes with a zip file called src.zip. Sometimes, for unexplained reasons, Oracle don't always include the source. So for some older versions (and who knows about the future) you have to get hold of the Java source in another way. It's worth also being aware that, in the past, Oracle have sometimes included the source with the Linux version of the JDK, but not with the Windows one.
I just unzipped this file... the top directories are "com", "java", "javax", "launcher" and "org". Directory launcher contains no files to document.
You can generate the javadocs very very simply from any or all of these by CD'ing at the command prompt/terminal to the directory ...\src. Then go
javadoc -d docs -Xmaxwarns 10 -Xmaxerrs 10 -Xdoclint:none -sourcepath
. -subpackages java:javax:org:com
NB note that there is a "." after -sourcepath
Simple as that. Generating your own javadocs also has the huge advantage that you know they are precisely the right javadocs for the JDK you are using on your system.
The same applies to documenting any and all Java .jars (with source) which you use. However, all versions of most jars will be found with their documentation available for download at Maven Central http://search.maven.org...
JavaFX API documentation
You could download the Mac 2.2 preview release from here and unzip it.
http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html
The Javadoc won't quite match 2.1, but it will be close and if you use the preview instead, it will match exactly.
For the download of latest java documentation(jdk-8u77) API
Navigate to http://www.oracle.com/technetwork/java/javase/downloads/index.html
Under Addition Resources and Under Java SE 8 Documentation
Click Download button
Under Java SE Development Kit 8 Documentation > Java SE Development Kit 8u77 Documentation
Accept the License Agreement and click on the download zip file
Unzip the downloaded file
Start the API docs from
jdk-8u77-docs-all\docs\api\index.html
For the other java versions api download, follow the following steps.
Navigate to http://docs.oracle.com/javase/
From Release dropdown select either of Java SE 7/6/5
In corresponding JAVA SE page and under Downloads left side menu
Click JDK 7/6/5 Documentation or Java SE Documentation
Now in next page select the appropriate Java SE Development Kit 7uXX Documentation.
Accept License Agreement and click on Download zip file
Unzip the file and Start the API docs from
jdk-7uXX-docs-all\docs\api\index.html
The updated latest version of "The Java language Specification" can be found via the following links.
Java 7
Java 8
For example, Java Platform Standard Edition 7 Documentation has a link to download "JDK 7 Documentation" in the sidebar under "Downloads". I'd expect the same for other versions.
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=
I have installed Eclipse 3.3 on Mac OS X and it does not contain the src.zip file I am used to seeing with Windows and Linux installations. Where can I download the complete source code for the Java 1.5 JDK (must be specific versions).
I have been able to locate the full source code, however it contained the ungenerated Buffer implementations and so navigating NIO code was not possible.
Looking for the Java source typically found in the JDK src.zip, not the VM source.
You can get the Developer Documentation, which includes the source. The download requires you to have an ADC account.
Brian Clapper has already mentioned it in a comment, but the JDK downloads from Sun include src.zip. I don't know if there's any way to get it other than installing on a target platform, but you can install it on a Windows or Linux (virtual) machine and get src.zip from there.
Specifically for Java 1.5, the downloads are here
[Update]
Also, source distributions of the JDK are available from Sun from here. It seems that SCSL link is messed up and throws you for a loop, but JRL still works (if you don't mind going through it).
It is located in
/System/Library/Frameworks/JavaVM.framework/Versions.1.5.0/Home/src.jar
I do have the XCode stuff installed found on the installation disks that come with a Mac, so I don't know if the source code appears on a standard Mac installation of OSX.
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/src.jar
More details on:
http://confluence.concord.org/display/CCTR/Get+local+copies+of+Mac+OS+X+Java+source+code+and+Javadoc
Unclear if that is even possible since the Mac JDK is not, to my knowledge, open source. It was created by Apple not Sun.