1

I'm trying to export the game I'm working on in Processing 4 as a windows executable. The code itself is working fine, I can post all of it if necessary, but when I try and export it I get the following error:

java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null

I checked all the preferences in the preferences.txt file, most of them have a value, except the proxy related lines and run.options.

I searched the web but couldn't find any answer as to what could be causing this.

I'm running Processing 4.0b4 in java mode on Windows 10 Pro 21H2 and trying to export to Windows (Intel 64-bit)

my java version:

openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

The full exception:

Exporting application...

java.lang.NullPointerException: Cannot invoke "String.split(String)" because the return value of "processing.app.Preferences.get(String)" is null
at processing.mode.java.JavaBuild.exportApplication(JavaBuild.java:584)
at processing.mode.java.JavaMode.handleExportApplication(JavaMode.java:187)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:494)
at processing.mode.java.ExportPrompt.trigger(ExportPrompt.java:156)
at processing.mode.java.JavaEditor.handleExportApplication(JavaEditor.java:516)
at processing.mode.java.JavaEditor.lambda$buildFileMenu$0(JavaEditor.java:239)
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.AbstractButton.doClick(AbstractButton.java:354)
at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:983)
at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2947)
at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:710)
at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
at java.desktop/javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:688)
at java.desktop/javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:311)
at java.desktop/javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:297)
at java.desktop/javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:3040)
at java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:3032)
at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2909)
at processing.app.syntax.JEditTextArea.processKeyEvent(JEditTextArea.java:1991)
at processing.mode.java.JavaTextArea.processKeyEvent(JavaTextArea.java:140)
at java.desktop/java.awt.Component.processEvent(Component.java:6403)
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.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1952)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:883)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1150)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1020)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:848)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4882)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
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)
WolfyD
  • 865
  • 3
  • 14
  • 29
  • I have the same thing. I hope that my error just randomly disappears like yours did. – Mathematical Lie Feb 13 '22 at 08:37
  • The last thing I did before it fixed itself, was that I started to do the export again, and than cancelled the export window. I don't know how much that helps, but good luck with it @DesmosArtist ! – WolfyD Feb 14 '22 at 08:36
  • Thanks @WolfyD! That wasn't exactly what got it to work for me, but this is what did. First I did what you said but it didn't work, then I tried to export for 'macOS Apple Silicon' instead of my computer's 'macOS Intel 64-Bit'. This worked but obviously I couldn't run it. Then I tried to export for 'macOS Intel 64-Bit' again and it worked! – Mathematical Lie Feb 14 '22 at 23:27
  • 1
    Glad to hear @DesmosArtist Congratulations :) – WolfyD Feb 15 '22 at 08:21

3 Answers3

1

I had the same issue. By removing the embedding of java, and exporting, the message was gone. The best part is, after that you can now set the embedding of java to true, and it works as expected.

TimJ0212
  • 11
  • 1
  • 2
  • Thanks for sharing! This method didn't work for me, I originally tried both with and without the embedded java, but it might help some others! – WolfyD Feb 17 '22 at 10:38
0

After doing nothing differently for like a week, trying multiple times during all this time and getting the same error, I tried one last time tonight and for no apparent reason, it decided to work, since than it has been working consistently.

I have absolutely no idea what changed, but I guess it's working now.

(Though I don't know what I need to do if it stops working again...)

WolfyD
  • 865
  • 3
  • 14
  • 29
0

For anyone encountering this error trying to export via the command line, specifying an output directory fixed it for me. The CLI documentation says the output folder argument is optional, but apparently it isn't.

Uhai
  • 1