Code Monkey home page Code Monkey logo

Comments (12)

pron avatar pron commented on May 27, 2024

What's your OS? How did you install the JVM?

from capsule.

ebridges avatar ebridges commented on May 27, 2024

The method Capsule#parseJavaVersion() relies on this regex:

private static final Pattern PAT_JAVA_VERSION = Pattern.compile("(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(_(?<update>\\d+))?(-(?<pre>[^-]+))?(-(?<build>.+))?");

This regex fails when given a version of "1.8".

from capsule.

ebridges avatar ebridges commented on May 27, 2024

OS is "Ubuntu 14.04.1 LTS" & here are the relevant steps in the playbook to configure & install the JDK:

    - name: add oracle jdk repository
      apt_repository: repo=ppa:webupd8team/java

    - name: accept jdk license terms
      shell: echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections

    - name: set java_home
      lineinfile: dest=/etc/environment state=present regexp='^JAVA_HOME' line='JAVA_HOME={{ java_home }}'

    - name: install ubuntu packages
      apt: pkg={{ item }} state=installed
      with_items:
      - oracle-java8-installer

from capsule.

pron avatar pron commented on May 27, 2024

I think the issue of parsing "1.8" is unrelated.

from capsule.

ebridges avatar ebridges commented on May 27, 2024

I was using the sourceCompatibility field in the Gradle script for the project to set Min-Java-Version: field in the manifest. Even if I set sourceCompatibility to be "1.8.0", Gradle rounded that down to "1.8".

from capsule.

pron avatar pron commented on May 27, 2024

See #58 (just fixed) for the "1.8" issue.

from capsule.

ebridges avatar ebridges commented on May 27, 2024

The parsing of the version is the deeper issue that ultimately caused the NPE.

A more insidious issue is that isMatchingJavaVersion() is swallowing the IllegalArgumentException thrown by parseJavaVersion(), thus masking the real problem and leading to an NPE downstream.

from capsule.

pron avatar pron commented on May 27, 2024

Alright, this has been fixed.
You can either wait for Capsule 1.0 to be released in a few short weeks, copy the fix to your clone of 0.10.0, or change the name of your JVM directory.

from capsule.

ebridges avatar ebridges commented on May 27, 2024

Well all I needed to do was change it to use "1.8.0" as the version number, the name of the JDK home directory is a red herring.

You should change the code to not swallow the IllegalArgumentException being caught here.

from capsule.

pron avatar pron commented on May 27, 2024

Well, the Java home dir wasn't being recognized either, so those were two actual bugs.

from capsule.

ebridges avatar ebridges commented on May 27, 2024

Your call, but I'm not so sure that's the case. I didn't change the directory in JAVA_HOME -- only changed Min-Java-Version to be "1.8.0" and it worked.

Maybe I'm just getting lost in the code but if it's not recognizing the Java home dir, how did it get the version string "1.8.0_31" (see above error message)?

from capsule.

pron avatar pron commented on May 27, 2024

how did it get the version string "1.8.0_31"

Because that JVM happened to be the one used to launch the capsule itself, so it got the version number from the java.version property.

from capsule.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.