iT邦幫忙

0

執行JAVA跳出the selection cannot be launched,and there are no recent

  • 分享至 

  • xImage

用Eclipse執行Convex hull的時候一直跑不動
上網看了一下好像是main function的問題
不過不知道怎麼解決

不是本科生,之前沒學過JAVA 求助..

以下程式碼
https://pastebin.com/xVWw59im

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
fillano
iT邦超人 1 級 ‧ 2020-06-01 09:52:24

把檔案下載成Convex.java,在console用javac直接編譯,就可以跑了。

console輸出大概像這樣:

Feng-Hsu-Pingteki-MacBook-Pro:builds fillano$ javac Convex.java
Feng-Hsu-Pingteki-MacBook-Pro:builds fillano$ java Convex
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
	at java.util.Vector.get(Vector.java:748)
	at Convex.convexhull(Convex.java:144)
	at Convex.paint(Convex.java:111)
	at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
	at sun.lwawt.LWRepaintArea.paintComponent(LWRepaintArea.java:59)
	at sun.awt.RepaintArea.paint(RepaintArea.java:240)
	at sun.lwawt.LWComponentPeer.handleJavaPaintEvent(LWComponentPeer.java:1314)
	at sun.lwawt.LWComponentPeer.handleEvent(LWComponentPeer.java:1198)
	at java.awt.Component.dispatchEventImpl(Component.java:4957)
	at java.awt.Container.dispatchEventImpl(Container.java:2292)
	at java.awt.Window.dispatchEventImpl(Window.java:2750)
	at java.awt.Component.dispatchEvent(Component.java:4703)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

跑起來:
https://ithelp.ithome.com.tw/upload/images/20200601/20000108bI47nH75P0.png

我要發表回答

立即登入回答