'Java Processing ControlP5 Unexpected Exporting Error

I am trying to export my code as a clickable shortcut that calls Arduino code when a button is clicked. However, I ran into a bunch of errors and I am not sure why. I have plugged my Arudino and it runs and does what it is supposed to without any errors. But when exporting, it doesn't work. Does anyone have an idea?

Side question: I am also trying to change the font of the .setLabel. I want to access more fonts, but it seems like there are only certain fonts I can change into and it works like Times New Roman and Arial Black. But for example, when I change it into Verdana, it gives me the default processing font. Is there a library I can import to get more fonts? I have seen some people using Verdana but I am not sure how.

If there are any other information I should share please let me know!

These are snips of the errors I ran into:


\`\[0\] "COM3"

\[1\] "COM5"

\[2\] "COM6"

\[3\] "COM13"

ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/libraries/controlP5

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.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)

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)\`

I have 2 versions. My first version did not contain string.split, but still gave me the error

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

I am not sure what to do. Thank you for reading this



Solution 1:[1]

Unfortunately I won't be able to answer in great detail.

It looks like there's an error exporting the exe (getting preferences while exporting).

(You should post which version of Processing you're using and which Windows version just in case other have the same issue and maybe a fix.)

My hunch is this is a later version. As a workaround try exporting from an older version of Processing (e.g. 3.4).

Regarding the font, have a look at:

  • Processing > Tools > Create Font
  • loadFont()
  • once everything works as expected with loading a PFont, try the ControlP5controlFont example (also accessible via Processing > Examples > Contributed Libraries > ControlP5 > use > ControlP5controlFont)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 George Profenza