我可以在Ceylon M1 Newton中使用Java Core库吗?

时间:2012-01-21 16:12:47

标签: java-interop ceylon

我已经下载了Ceylon SDK并试着玩一下,但过了一会儿我意识到了这一点:

...

  

SDK

     

目前,唯一可用的模块是语言模块   锡兰语言,包含在发行版中。

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

这会解释为什么我在这里ClassNotFoundException?或者我错过了其他什么?

$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 个答案:

答案 0 :(得分:2)

Java互操作尚未准备就绪,因此M1不包含它。计划用于M2:

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