ADTPro / adtpro

Apple Disk Transfer ProDOS (ADTPro)
http://adtpro.com
GNU General Public License v2.0
133 stars 19 forks source link

ADTPro 2.1.0 on Apple M1 silicon - issues with jssc #142

Closed Minisector closed 1 year ago

Minisector commented 3 years ago

Hello there, first of all - I love ADTPro :-)

I am trying to run ADTPro 2.1.0 on a Mac Mini M1 running Mac OS Big Sur 11.6, with the latest JVM:

minnie@MacMiniM1 ADTPro-2.1.0 % java --version
java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

ADTPro cannot open the "Serial configuration" window. When launching ADTPro.command I get the following:


Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the jssc library: Couldn't load library library jssc
    at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:90)
    at jssc.SerialPortList.<clinit>(SerialPortList.java:43)
    at org.adtpro.transport.SerialTransport.getPortNames(Unknown Source)
    at org.adtpro.gui.SerialConfig.enumeratePorts(Unknown Source)
    at org.adtpro.gui.SerialConfig.<init>(Unknown Source)
    at org.adtpro.gui.SerialConfig.allocateSingleton(Unknown Source)
    at org.adtpro.gui.SerialConfig.getSingleton(Unknown Source)
    at org.adtpro.gui.Gui.<init>(Unknown Source)
    at org.adtpro.ADTPro.main(Unknown Source)

..and when I select "Serial configuration", the following exception appears:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class jssc.SerialPortList
    at org.adtpro.transport.SerialTransport.getPortNames(Unknown Source)
    at org.adtpro.gui.SerialConfig.enumeratePorts(Unknown Source)
    at org.adtpro.gui.SerialConfig.<init>(Unknown Source)
    at org.adtpro.gui.SerialConfig.allocateSingleton(Unknown Source)
    at org.adtpro.gui.SerialConfig.getSingleton(Unknown Source)
    at org.adtpro.gui.Gui.serialConfigGui(Unknown Source)
    at org.adtpro.gui.Gui$MenuAction.actionPerformed(Unknown Source)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
    at java.desktop/com.apple.laf.AquaMenuItemUI.doClick(AquaMenuItemUI.java:157)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
    at java.desktop/java.awt.Component.processEvent(Component.java:6391)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

All of this on a clean install. All I tried so far has failed... could you please help me out? I have no issue with 2.0.3. Thanks for reading!

Minnie

david-schmidt commented 3 years ago

This will require pulling in a newer jssc (https://github.com/java-native/jssc/issues/74) and re-packaging. So this will be in the "next" release.

Minisector commented 3 years ago

Thank you for the pointer! I have copied https://github.com/java-native/jssc/releases/download/v2.9.4/jssc-2.9.4.jar into the lib folder and changed ADTPro.command to load it instead of 2.9.2, and now it works!! @david-schmidt thanks a lot!

Minnie

jquast commented 1 year ago

I am also trying to use ADTPro 2.1.0 on a Mac Mini M1. But I am not as successful as you. Can you suggest what I am doing wrong? I am using MacOS Montery version 12.5.1

So, I try the same solution suggested:

-$HEADLESS"$MY_JAVA_HOME"java -Xms256m -Xmx512m -cp "$ADTPRO_HOME"lib/ADTPro-2.1.0.jar:"$ADTPRO_HOME"lib/AppleCommander/AppleCommander-1.3.5.13-ac.jar:"$ADTPRO_HOME"lib/jssc/jssc-2.9.2.jar:"$ADTPRO_HOME"lib/jssc/slf4j-nop-1.7.9.jar org.adtpro.ADTPro $ +$HEADLESS"$MY_JAVA_HOME"java -Xms256m -Xmx512m -cp "$ADTPRO_HOME"lib/ADTPro-2.1.0.jar:"$ADTPRO_HOME"lib/AppleCommander/AppleCommander-1.3.5.13-ac.jar:"$ADTPRO_HOME"lib/jssc/jssc-2.9.4.jar:"$ADTPRO_HOME"lib/jssc/slf4j-nop-1.7.9.jar org.adtpro.ADTPro $


Re-launch and new exception is displayed:

$ ./ADTPro.command ADTPro Server version 2.1.0

Exception in thread "main" java.lang.NoClassDefFoundError: jssc/SerialPortTimeoutException at org.adtpro.gui.SerialConfig.enumeratePorts(Unknown Source) at org.adtpro.gui.SerialConfig.(Unknown Source) at org.adtpro.gui.SerialConfig.allocateSingleton(Unknown Source) at org.adtpro.gui.SerialConfig.getSingleton(Unknown Source) at org.adtpro.gui.Gui.(Unknown Source) at org.adtpro.ADTPro.main(Unknown Source) Caused by: java.lang.ClassNotFoundException: jssc.SerialPortTimeoutException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 6 more

- Clicking button "Serial" continues to show error, "There are no serial ports", 
![Screen Shot 2023-07-24 at 7 47 09 PM](https://github.com/ADTPro/adtpro/assets/972584/a2c644f0-9993-42b9-b260-7b7797f4c554)
- But, there is a serial port,

$ ls -lrt /dev/usbserial crw-rw-rw- 1 root wheel 0x9000002 Jul 24 17:14 /dev/tty.usbserial-220 crw-rw-rw- 1 root wheel 0x9000003 Jul 24 19:29 /dev/cu.usbserial-220

And I can communicate through this serial port using cu,

sudo cu -l /dev/cu.usbserial-220 -s 9600

If I click the Audio button, another exception is displayed,

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: jssc/SerialPortException at org.adtpro.gui.Gui.startComms(Unknown Source) at org.adtpro.gui.Gui.actionPerformed(Unknown Source) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:411) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389) at java.desktop/java.awt.Component.processEvent(Component.java:6391) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Caused by: java.lang.ClassNotFoundException: jssc.SerialPortException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 37 more

jquast commented 1 year ago

Also, I have tried,

Seems like some kind of issue with the classpath to cause this error,

Exception in thread "main" java.lang.NoClassDefFoundError: jssc/SerialPortTimeoutException
jquast commented 1 year ago

Sorry for the noise, I had forgotten to replaced jssc-2.9.4.jar into the correct folder after re-installing ADTPro a few times.

I have re-tested ADTPro 2.1.0, on Mac M1, with both intel and arm64 Java 8 JRE from Oracle, and both are loading the serial port successfully. I think the initial problem was with using a previous release of java, that it would not load the newer build of jssc.

david-schmidt commented 1 year ago

No problem - if there was faster turnaround on releases, you'd have this already by default. Glad you got it going, though.