I am wanting to create a gihub repository that offers benchmarking code that
works for concurrent features available only in JDK 1.7 (Fork/Join) as well as for older ones found in JDK 1.6.
Offering both options is important for what I need.
Does anyone have a recommendation how should I structure the repository.
I was planning on having a repo called and under it:
jdk17
build
src
mycode ...
jdk16
build
src
mycode
Please suggest any alternatives, possibly use of Maven or other more practical approaches, if any.
Unless you need to have source code for both versions available at the same time, you can just put them in separate branches.
Related
I want to download/install an Eclipse IDE for Java/Python, but the Eclipse website doesn't indicate which package is suitable for PyDev. Which one should I download/install?
Also, if I need to do Javascript, CSS, HTML or PHP programming, will I need to download/install separate Eclipse IDEs?
Here are the different packages:
Eclipse Packages Website
On the packages page there's a link (easily overlooked, unfortunately) labeled Compare & Combine Packages. That page basically answers your question:
These packages are provided as a convenience to users; they represent common configurations of Eclipse projects that are often used together. However, since Eclipse is, at its core, an expandable platform, you can easily add other features and plugins to any of these packages. Just choose and install the package that most closely meets your needs, then follow these instructions to add features that you need.
This answer is not meant to point a specific offsite resource, but the principle that comes to play here: using eclipse plugins to add a support for a specific language/feature!
First of all, there is no predefined eclipse build for python.
You can simply install the "Java developer" one and then manually add python support via the eclipse marketplace, for example by installing the pydev plugin.
You can go ahead with Eclipse IDE for Java EE Developers.
Once it is installed you can go to Help->Install New Software and can install all other plugins as per your requirements.
For example to install Python use the following Link.
I have an application which I would like to deploy, compiled for java 1.8.0_151. However, the user has only 1.8.0_25. User cannot launch the app because LocalDateStringConverter is missing.
As written here (https://docs.oracle.com/javase/8/javafx/api/javafx/util/converter/LocalDateStringConverter.html) this class has been added only in 8u40
How can I compile (is it possible?) a jar with dependencies for the specific java version of the user?
Or maybe I misunderstood something, new to java here
EDIT I tried specify the pricise version with update number in my pom.xml but it didn't help
There are a two ways to approach this:
You have to set your environment to use the JDK that is expected by the user. In this case 1.8.0_25 - you need to develop all logic using this JDK and the classes available in it. If LocalDateStringConverter is your only dependency missing, you can easily find out the source code and duplicate the logic inside your project as utility class and use that instead.
You can ask/help/advise your user to upgrade their environment to more recent JDK version (security reasons and such). As you are aware most software has minimum requirements to run and it's expected from the end user to meet those requirements in order to run the software.
As already mentioned you can use the Maven Enforcer Plugin to enforce specific java version, but this will not make the functionality from 1.8.0_151 available in 1.8.0_25.
Compiling your code with 1.8.0_25 and hoping that the newer versions are backward compatible is probably the easiest solution. Assuming you have automated tests this will catch problems like a missing class.
The other option would be to build an executable bundle containing both your application and the entire JRE 1.8.0_40 or newer. This is going to result in your software bundle growing by dozens of MBs so I would not recommend it. However one way to do it would be to use Launch4j as advised here.
You can try implementing your own LocalDateStringConverter but how many other classes are you missing? What if there are other subtleties in behaviour between versions? Based on java.com 1.8.0_25 was released on October 14, 2014 while 1.8.0_151 on October 17, 2017. That's 3 years of Java development that your user is missing.
I am going to contribute to Java Community and I am interested in JVM.
Now I would like to download the most updated JVM Hotspot source code and track the updates.
First, I go to http://openjdk.java.net/ .
On its left side I find some useful tag
Source code:
Mercurial
Bundles
...
JDK 6
JDK 7
JDK 7 Updates
JDK 8 · Java SE 8
JDK 8 Updates
JDK 9 · Java SE 9
JDK 10
I can only find instruction about how to download source code of JDK8u: http://openjdk.java.net/projects/jdk8u/
Status
We're open for fixes for 8u152 in the jdk8u-dev forest. (The post time is 2017-06-06 14:23:36)
Source code
The jdk8u-dev forest for ongoing development can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev;cd jdk8u-dev;sh get_source.sh .
The corresponding master forest jdk8u can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u;cd jdk8u;sh get_source.sh .
In addition, the source code for the last release, 8u102, is available by cloning the 8u master forest : http://hg.openjdk.java.net/jdk8u/jdk8u and using the 'jdk8u102-b14' mercurial tag.
But it appears that jdk9 and jdk10 are also on the list. Are they the most updated source code and how can I download them?
JDK9 page does not provide instructions about how to get source code.
JDK9 : http://hg.openjdk.java.net/jdk9
JDK10: http://openjdk.java.net/projects/jdk10/
Besides, if the Java Community release a new update, what is the best way to update my current source code? Download again or use Mercurial tool?
What is forest in jdk source code? Is it similar to branch in git?
Also, I can find another way to download JVM Hotspot source code from github in JetBrains:
https://github.com/JetBrains/jdk8u_hotspot/tree/d37547149a7c5647ebffbbb62525cc62bd8e2673
But I am not sure this one is the most updated one.
This depends on what you mean by 'most updated'.
Actually, all of jdk8u, jdk9 and jdk10 repositories are kept up-to-date; they are just separate projects having different status and accepting different set of changes.
jdk8u has the most recent changes that will appear in the future updates of JDK 8. These updates mainly consist of bug fixes.
jdk9 repository contains up-to-date code that will be released soon as JDK 9. The project is now in Rampdown phase 2 meaning that only showstopper bugs can be fixed there. It's not defined yet what will happen to this repository after JDK 9 release - e.g. give start for something like jdk9u.
jdk10 contains the ongoing work on future version of Java SE platform. Important improvements made here are likely to be backported to jdk9 sometime later (of course, if they comply with the specifications).
Note that new features are not developed directly in this repository. New features must go through JEP process. Some bigger features may be even hosted in separate projects like Panama or Valhalla.
The official repositories of OpenJDK projects are hosted at http://hg.openjdk.java.net
To get the sources use Mercurial, e.g.
hg clone http://hg.openjdk.java.net/jdk10/jdk10
It contains several nested repositories. HotSpot JVM is under hotspot:
hg clone http://hg.openjdk.java.net/jdk10/jdk10/hotspot
Later you can use hg pull -u to sync your local repository with the updates from the master.
In the parent repository you'll also find the instructions how to get the sources and to build OpenJDK: common/doc/building.md. There is a similar document in jdk9 repo.
I'm maintaining a parent pom for my team which will provide the latest compatible version of various maven plugins per the JDK that the project uses. Sometimes if a project utilizes an older version of Java (like 1.5) maven will fail due to a plugin requiring a newer version. Is there a way to get a map of a given plugin and see what the minimum java version is for said plugin? I was thinking there was some sort of report or something that would show me that, but I'm not seeing anything.
What about: https://builds.apache.org/view/M-R/view/Maven/job/dist-tool-plugin/site/dist-tool-prerequisites.html Apart from that on every plugin page you can find the goals page which contains the information you need. One more thing if you are using not the most uptodate versions all older versions pages are available where you can look at which version which JDK versions uses. It shouldn't be problem to write some kind of script to programmatically extract the information of the older plugins. The above site contains the informations of the uptodate plugins.
Apart from that plugin version selection basead on JDK version is not a good idea. The plugins have only a minimum version for JDK they need to run with. Apart from that they run on all versions (already on JDK 9 with one exception)...Furthermore plugins might require a minimum Maven version to run with which is either Maven 2.2.1 or Maven 3.0+ which shouldn't a problem.
You should define your plugins versions simply based on problems you might have but i would recommend to keep uptodate with your plugins.
If you need running you build with JDK 6 for example, but you use Maven 3.3.X which needs JDK 7 to run you can achieve this by using toolchain to handle this situation.
In theory this shouldn't be an issue. Maven will use the Java version you run it with, so the plugin's dependency will be satisfied, independent of the project's language level. Just make sure your devs are using a current version.
Example: running Maven with Java 8 will satisfy the dependency of a Plugin that requires Java 8, independent of the project's source and target level.
(With dependencies it's more complicated, I am afraid, but since you are not actually coding against your plugins, you should be fine)
I found HTMLUnit is useful for me,but the files are too old.
So I use svn co https://htmlunit.svn.sourceforge.net/svnroot/htmlunit htmlunit to check the code,But I don't know how to use them.
Is there somebody can tell me how to compile them?
I see you have very little knowledge of Subversion.
I could link you to lots of verbose documentation, but let's make it quick and easy: what you downloaded is the whole repository, containing lots of redundant code, majorly the three canonical directories branches tags trunk.
In order to obtain usable code, you either download a stable (tag) version or unstable version (trunk). Advantage of trunk over tag is that it mostly contains new features, but tags are generally stable.
Try to get the following URL: https://htmlunit.svn.sourceforge.net/svnroot/htmlunit/tags/HtmlUnit-2.8/, then you could try ant to build (I'm no Java expert, does the package have an ant script?)
You don't need to take the detour of building it from sources yourself. The latest version is 2.8, and it's readily available from the Maven central repository. If you're not using a dependency manager, just grab the jar from here:
http://repo2.maven.org/maven2/net/sourceforge/htmlunit/htmlunit/2.8/
Check out the projects instructions on how to get and build the latest version !
http://htmlunit.sourceforge.net/gettingLatestCode.html.
It seems it ships as a collection of submodules, each with its own build system (some of them maven, some ant).
The latest release dates back to August 2010, doesn't seem to be that old, but if you're aware of improvements you need which are available only in later versions I suggest you look at their CI server, which provides already the artifacts from the latest build.