Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce java provided by IBM #179

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions camel/src/main/java/com/github/theprez/manzan/ManzanMainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ public static void main(final String... _args) throws Exception {
return;
}

// Check to make sure we use right java version on IBM i
if (Config.isIBMi()){
// Get the Java vendor property
String javaVendor = System.getProperty("java.vendor");
// Check if the vendor is IBM
if (!javaVendor.toLowerCase().contains("ibm")) {
System.out.println("Java vendor: " + javaVendor);
System.err.println("Error: This application requires Java provided by IBM");
System.exit(1);
}
}

for(final String arg:_args) {
if(arg.startsWith("--configdir=")) {
System.setProperty(Config.DIRECTORY_OVERRIDE_PROPERTY, arg.replaceFirst("^[^=]+=", ""));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public abstract class Config {
public static final String DIRECTORY_OVERRIDE_PROPERTY = "manzan.configdir";
public static final String COMPONENT_OPTIONS_PREFIX = "componentOptions.";

protected static boolean isIBMi() {
public static boolean isIBMi() {
final String osName = System.getProperty("os.name", "Misty");
return "os400".equalsIgnoreCase(osName) || "os/400".equalsIgnoreCase(osName);
}
Expand Down
8 changes: 6 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ This document will outline how to install Manzan on to IBM i. Manzan is install

Building Manzan is easy for IBM i and we provide makefiles to simplify the entire process.

## Which Java to use
Use a Java version provided by IBM, which is at least version 8. When running the `java -version` command, the output
should contain the string `IBM`. Ex. `IBM Semeru Runtime Certified Edition`. Otherwise, Manzan may not function properly.

## Install from GitHub release

To install from a github release, simply perform the following steps:
1. Download the latest binary release from [the releases page](https://github.com/ThePrez/Manzan/releases)
1. If you didn't download to IBM i directly, transfer the `.jar` file to IBM i using technique of your choice
1. Run `java -jar <name of jar file>`
2. If you didn't download to IBM i directly, transfer the `.jar` file to IBM i using technique of your choice
3. Run `java -jar <name of jar file>`

For instance, to install version `0.0.6`, the steps from an IBM i (using open source `wget`) would look like:
```bash
Expand Down
Loading