WolfyD
WolfyD

Reputation: 873

Export Application in Processing 4 fails with error message

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)

Upvotes: 1

Views: 735

Answers (3)

Uhai
Uhai

Reputation: 1

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.

Upvotes: 0

TimJ0212
TimJ0212

Reputation: 11

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.

Upvotes: 1

WolfyD
WolfyD

Reputation: 873

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...)

Upvotes: 0

Related Questions