All Projects → IanDarwin → Javasrc

IanDarwin / Javasrc

Licence: other
Ian's Collected code examples from the O'Reilly Java Cookbook & elsewhere

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Javasrc

Rlenv.directory
Explore and find reinforcement learning environments in a list of 150+ open source environments.
Stars: ✭ 79 (-52.12%)
Mutual labels:  environment
Termux Extra Packages
Stars: ✭ 110 (-33.33%)
Mutual labels:  environment
Fig
A minimalist Go configuration library
Stars: ✭ 142 (-13.94%)
Mutual labels:  environment
Grabs
Front-End Development Environment
Stars: ✭ 89 (-46.06%)
Mutual labels:  environment
Shellfuncs
Python API to execute shell functions as they would be Python functions
Stars: ✭ 96 (-41.82%)
Mutual labels:  environment
Slate Language
The Slate programming language
Stars: ✭ 127 (-23.03%)
Mutual labels:  environment
Env Providers
👷 Load Laravel service providers based on your application's environment.
Stars: ✭ 73 (-55.76%)
Mutual labels:  environment
Env
Simple lib to parse environment variables to structs
Stars: ✭ 2,164 (+1211.52%)
Mutual labels:  environment
Drupal Vm
A VM for Drupal development
Stars: ✭ 1,348 (+716.97%)
Mutual labels:  environment
Next Runtime Dotenv
Expose environment variables to the runtime config of Next.js
Stars: ✭ 136 (-17.58%)
Mutual labels:  environment
X
Desktop environment in the browser.
Stars: ✭ 1,316 (+697.58%)
Mutual labels:  environment
Envh
Go helpers to manage environment variables
Stars: ✭ 95 (-42.42%)
Mutual labels:  environment
Envy
Envy makes working with ENV variables in Go trivial.
Stars: ✭ 128 (-22.42%)
Mutual labels:  environment
Homies
linux package management
Stars: ✭ 86 (-47.88%)
Mutual labels:  environment
Phpdotenv
Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
Stars: ✭ 11,648 (+6959.39%)
Mutual labels:  environment
Envinject Plugin
This plugin makes it possible to setup a custom environment for your jobs
Stars: ✭ 74 (-55.15%)
Mutual labels:  environment
Geoman
Tensorflow Implement of GeoMAN, IJCAI-18
Stars: ✭ 113 (-31.52%)
Mutual labels:  environment
Sustainable Earth
A curated list of all things sustainable
Stars: ✭ 159 (-3.64%)
Mutual labels:  environment
Envy
Envy automatically exposes environment variables for all of your Go flags
Stars: ✭ 150 (-9.09%)
Mutual labels:  environment
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-20.61%)
Mutual labels:  environment

= JavaCook Source Files (javasrc)

This is my assorted collection of (you guessed it) Java source. It remains focused on building with https://maven.apache.org/[Maven] and https://eclipse.org/[Eclipse].

About a third of these files are featured in my O'Reilly https://javacook.darwinsys.com/[Java Cookbook]. I use a script (+copyCodeSamples+) to pre-format these for inclusion in the O'Reilly publishing toolchain; these will have // tag::foo[] and // end::foo[] comments to mark sections for mechanical inclusion into the book. These are just comments to Java tooling and can be completely ignored by people looking at the source code normally. Not all files with these comments necessarily appear in the book; files are included from the manuscript using https://asciidoctor.org[asciidoctor]'s include mechanism and, when a code sample gets dropped from the book, I have no motivation to edit the tags out of the code, in case I use it elsewhere.

== Structured as Maven Modules

This repo consists of about a dozen Maven modules (aka subdirectories :-)), as follows:

  • main - everything that isn't in one of the others
  • desktop - GUI/Graphics, JavaFX, comm devices, etc.
  • ee - Jakarta EE (Java EE, J2EE) stuff
  • graal - Only works with graal vm
  • jlink - Not ready yet?
  • json - JSON parsing and formatting with various APIs
  • restdemo - REST
  • spark - Apache SPARK
  • unsafe - com.sun.Unsafe
  • testing - code that expands on testing (other modules have normal unit tests)
  • xml - XML parsing and formatting with various APIs

Prior to the Java Cookbook revision (late 2019/early 2020), this repo was one single module with no sub-modules. This became difficult to manage and to use, since, to compile anything, a user would have to wait for Maven to download all the dependencies and their dependencies and theirs... That revision seemed like a good time to split the whole shebang into smaller pieces. Each module has its own POM file, Maven structure, etc.

A main reason was that the CLASSPATH was becoming unmanageable. Not to mention MODULEPATH, and the time it takes to build the whole thing. Right now there is a lot of stuff in the "main" module, but this will get broken out into a few additional modules.

Now that it's done this way, you can choose to just build one module or another, without having Maven download 3/4 of the Internet for dependencies. Just cd into one of the module directories and invoke mvn there. Or you can do them all by invoking mvn in the top-level directory. Useful mvn targets include compile and test. Do not use mvn package as the jar files won't be useful on their own.

=== I broke it (but it's easy to fix)

Unfortunately for those who already had the original all-in-one javasrc checked out and an Eclipse project created in that directory, you should do the following:

  • In Eclipse, delete javasrc project (do NOT check 'delete contents on disk'!);
  • Delete the old target folder (only): {++rm -r++ or ++del/s++} javasrc/target;
  • Do a "git pull" to rearrange the project and get the extra pom files;
  • Back in Eclipse, ++File->New Java Project->browse to (but not into) workspace/javasrc/main++. Set project name to ++javasrc-main++. If asked to upgrade the JDK release, say OK. If asked to create a module-info, click Do Not Create. Click ++OK/Finish++.
  • You may want to create some or all of the other projects such as xml, jlink, spark, unsafe, ... Do this same way as previous step: File->new Java project etc. Recommmended names are javasrc-xml, javasrc-unsafe, etc.

The older 'javasrcee' repository was originally formed by splitting it off from this repository, several years ago. Now, with this modularization, it has been merged back in, as the ee module.

== No module-info

There are no module-info.java files in most of the subdirectories because this is not meant to be built and used as a library or even as a cohesive software base. A few that need them for imports &c have them.

== Notes on Individual Modules

testing:: Works under "mvn test". Compiles as an Eclipse project, but can't run due to a Junit 5 loading conflict (pull requests welcome on this one, thanks).

== Building

  • You MUST HAVE Java 11+ to successfully compile this whole package. Sorry if you are on some relic platform that doesn't have Java 9 or later. Even https://openbsd.org[OpenBSD] has Java 11 (Thanks Kurt!). Also sorry if your organization is stuck on Java 8 due to application server issues. I am updating the Java Cookbook for Java 13+ and these files are the examples for that book.

  • I am using Eclipse for most of my development, and Maven for building, and Jenkins for automated building. Most Ant scripts have been removed; the few that remain will eventually be converted to Maven exec:java configurations.

  • Building with Eclipse tested with Eclipse 4.x; MUST HAVE "m2e" (free in the Eclipse Marketplace) Compiles and tests pass.

  • Building with Maven 3.x works and tests pass.

  • Building with other platforms? Good luck, but let me know if it works.

  • If you really need Java 8, try removing the module-info files. But you're on your own. And you'll need some exclusions for files that use newer language features.

Ian Darwin

Java Cookbook author

http://www.darwinsys.com/contact.jsp

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].