Code Monkey home page Code Monkey logo

Comments (10)

chlarsson avatar chlarsson commented on May 24, 2024

Thanks for reporting this.

In Java 9 the "java.specification.version" property has been changed so that the former major version "1" as in "1.9" has been dropped and former minor version has become major version, e.g. "9"

Knopflerfish makes checks to verify the major version is "1"

You can go around the problem for now by setting:
Forg.osgi.framework.executionenvironment="JavaSE-9"

from knopflerfish.org.

dpolivaev avatar dpolivaev commented on May 24, 2024

Unfortunately I can not use this workaround because the Version constructor throws an exception given string "9.-1" which is currently returned as java version property value.

from knopflerfish.org.

chlarsson avatar chlarsson commented on May 24, 2024

Which OS and version of Java9 are you using?

from knopflerfish.org.

dpolivaev avatar dpolivaev commented on May 24, 2024

Windows 10
C:\Program Files\Java\jdk-9\bin>java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+143)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+143, mixed mode)

from knopflerfish.org.

chlarsson avatar chlarsson commented on May 24, 2024

Strange, I don't understand where the "9.-1" string comes from.

What happens if you start like this:
java -jar framework.jar -Forg.osgi.framework.executionenvironment="JavaSE-9" -init

from knopflerfish.org.

dpolivaev avatar dpolivaev commented on May 24, 2024

I have investigated what happens. It turned out that problems are in class FWProps.

System.getProperty("java.specification.version") returns "9" .
System.getProperty("java.version") would return "9-ea", but it is not relevant.
Therefore blocks

          if (startPos < endPos) {
            javaVersionMinor = Integer.parseInt(javaVersion.substring(startPos, endPos));
            startPos = endPos + 1;
            endPos = startPos;
            while (endPos < max && Character.isDigit(javaVersion.charAt(endPos))) {
              endPos++;
            }
            if (startPos < endPos) {
              javaVersionMicro = Integer.parseInt(javaVersion.substring(startPos, endPos));
            }
          }

are ignored,
javaVersionMajor is set to 9, javaVersionMinor and javaVersionMicro remain equal to -1.
and code

    setPropertyDefault(SYSTEM_PACKAGES_VERSION_PROP, Integer.toString(javaVersionMajor) + "."
        + javaVersionMinor);

sets this property to "9.-1" . It causes the exception in constructor of Version which I mentioned before.

Also in block

    if (!props.containsKey(FRAMEWORK_EXECUTIONENVIRONMENT)) {
      final StringBuffer ee = new StringBuffer();
      // Always allow ee minimum
      ee.append("OSGi/Minimum-1.0");
      ee.append(",OSGi/Minimum-1.1");
      ee.append(",OSGi/Minimum-1.2");
      // Set up the default ExecutionEnvironment
      if (1 == javaVersionMajor) {
        for (int i = javaVersionMinor; i > 1; i--) {
          ee.append((i > 5) ? ",JavaSE-1." : ",J2SE-1.");
          ee.append(i);
        }
      }
      props.put(FRAMEWORK_EXECUTIONENVIRONMENT, ee.toString());
    }

for-loop is not executed and in method SystemBundle.initSystemBundle() provideCapabilityString becomes 'osgi.ee;osgi.ee=OSGi/Minimum;version:List="1.0.0,1.1.0,1.2.0"'

As a workaround I can set properties

-Forg.knopflerfish.framework.system.packages.version=1.7.0
-Forg.osgi.framework.system.capabilities=osgi.ee;osgi.ee=JavaSE;version:List<Version>="1.2.0,1.3.0,1.4.0,1.5.0,1.6.0,1.7.0",osgi.ee;osgi.ee=OSGi/Minimum;version:List<Version>="1.0.0,1.1.0,1.2.0"

because I actually need JavaSE 7 only .
Well, after I force these property values it turns out that Java9 is still full of bugs, but is another issue.

from knopflerfish.org.

janste63 avatar janste63 commented on May 24, 2024

Fixed in framework 8.0.2. Available in https://bintray.com/knopflerfish/master/download_file?file_path=distrib_6.0.0.snapshot-1701031635-master%2Fknopflerfish_osgi_sdk_6.0.0.snapshot-1701031635-master.jar

from knopflerfish.org.

dpolivaev avatar dpolivaev commented on May 24, 2024

How can the fixed version be used as maven / gradle dependency?

from knopflerfish.org.

chlarsson avatar chlarsson commented on May 24, 2024

Sorry for the late reply.

The fix is in the KF 6.1 release and the framework and bundles are included in the KF 6.1 maven release repository.

All the maven artifacts are listed here
http://www.knopflerfish.org/releases/6.1.0/maven2/org/knopflerfish/kf6/KF-6.1.0_dependencyManagement.xml

The maven2 repo is browsable at:
http://www.knopflerfish.org/releases/6.1.0/maven2/org/knopflerfish/kf6/

The KF 6.1 bundles can

from knopflerfish.org.

dpolivaev avatar dpolivaev commented on May 24, 2024

Thank you.
We still have time before java 9 release.
And with this version it works fine.

from knopflerfish.org.

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.