0

I have a simple import from java.lang at the top of my file:

import java.lang {UnsupportedOperationException}

As expected, I get this error:

Package not found in imported modules: 
java.lang (add module import to module descriptor of hello)

However, I have tried adding each the following to the body of module.ceylon no avail:

import java.lang; // needs a version
import java.lang "7"; // not found
import java.lang "1.7.0"; // still not found
drhagen
  • 8,331
  • 8
  • 53
  • 82

1 Answers1

2

If you are using the Ceylon IDE for Eclipse you can hover over the original import error and see the following suggestion:

1 quick fix avialable:
    Add 'import java.base' to module descriptor

Clicking that link will make your module.ceylon look like this:

module mymodule "1.0.0" {
  import java.base "7";
}

And everything will work. I am sure someone more helpful will come along and explain why java.lang is in java.base. For now, just accept that it is.

drhagen
  • 8,331
  • 8
  • 53
  • 82
  • 3
    "The JDK has been mapped to Ceylon modules following the current JDK module list for Jigsaw, which is the module system planned for Java 9. Note that the Jigsaw module list is far from being final, so it is subject to change. java.base: the JDK base packages such as java.lang, java.util, java.io, java.net, java.text, NIO and security" http://ceylon-lang.org/documentation/1.1/reference/interoperability/java-from-ceylon/#importing_jdk_modules – gdejohn Oct 25 '14 at 19:03