Can I use Java Core libraries in Ceylon M1 Newton?

360 views Asked by At

I've downloaded the Ceylon SDK and try to play a little bit, but after a while I realize of this:

...

SDK

At this time, the only module available is the language module ceylon.language, included in the distribution.

http://ceylon-lang.org/blog/2011/12/20/ceylon-m1-newton/

Would that explain why am I getting ClassNotFoundException here? Or am I missing something else?

$cat source/time.ceylon 
import javax.swing { JFrame }
void run() {
    print( "Yeap, it's working ");
    value frame = JFrame();
    frame.pack();
    frame.visible := true;
}
$../../bin/ceylonc default 
error: warning: Has multiple constructors: javax.swing.JFrame
error: warning: Has conflicting attribute and method name 'layout': javax.swing.JFrame
error: warning: Has conflicting attribute and method name 'iconImage': javax.swing.JFrame
error: warning: Has multiple constructors: java.awt.Frame
error: warning: Has conflicting attribute and method name 'cursor': java.awt.Frame
error: warning: Has multiple constructors: java.awt.Window
error: warning: Has conflicting attribute and method name 'cursor': java.awt.Window
error: warning: Has conflicting attribute and method name 'minimumSize': java.awt.Window
error: warning: Has conflicting attribute and method name 'visible': java.awt.Window
error: warning: Has conflicting attribute and method name 'locationRelativeTo': java.awt.Window
error: warning: Has conflicting attribute and method name 'size': java.awt.Window
error: warning: Has conflicting attribute and method name 'bounds': java.awt.Window
error: warning: Has conflicting attribute and method name 'iconImage': java.awt.Window
error: warning: Has conflicting attribute and method name 'font': java.awt.Container
14 warnings
$../../bin/ceylon default 
Note: Ceylon repository 'http://modules.ceylon-lang.org' not yet available. 
Yeap, it's working 
Exception in thread "main" java.lang.RuntimeException: Error using Ceylon Runtime.
    at ceylon.modules.Main.main(Main.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.modules.Module.run(Module.java:243)
    at org.jboss.modules.Main.main(Main.java:313)
Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
    at java.security.AccessController.doPrivileged(Native Method)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:59)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:69)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:109)
    at ceylon.modules.Main.execute(Main.java:76)
    at ceylon.modules.Main.main(Main.java:55)
    ... 6 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at ceylon.modules.api.runtime.SecurityActions$2.run(SecurityActions.java:66)
    ... 12 more
Caused by: java.lang.NoClassDefFoundError: javax/swing/JFrame
    at run.run(time.ceylon:4)
    at run.main(time.ceylon)
    ... 17 more
Caused by: java.lang.ClassNotFoundException: javax.swing.JFrame from [Module "default:**NO_VERSION**" from Ceylon ModuleLoader: RootRepository: FileContentStore: /Users/oscarryz/.ceylon/repo]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:485)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:444)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:421)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:143)
    ... 19 more
1

There are 1 answers

0
Chochos On BEST ANSWER

Java interop is not ready yet, so M1 does not include it. It's planned for M2:

http://ceylon-lang.org/documentation/roadmap/#milestone_2