Josh
Josh

Reputation: 33

Getting StringIndexOutOfBoundsException when attempting to create a new Form in Codenameone

I am using Netbeans and updated to use the latest codenameone plugin. I am trying to follow the walkthrough tutorial at http://www.codenameone.com/blog/gui-builder-walkthru.html, but I keep on getting a StringIndexOutOfBoundsException when attempting to generate a new Form using the NewGuiBuilderWizardIterator. The following is the stacktrace that I'm seeing. Any and all help would be greatly appreciated!

SEVERE [com.codename1.actions.OpenGuiBuilderAction]: Relative path com\mycompany\myapp\MyApp.java
SEVERE [com.codename1.actions.OpenGuiBuilderAction]: Gui file C:\Users\joshua\Documents\NetBeansProjects\TestGui1\res\guibuilder\com\mycompany\myapp\MyApp.gui
SEVERE [com.codename1.actions.OpenGuiBuilderAction]: Props C:\Users\joshua\Documents\NetBeansProjects\TestGui1\codenameone_settings.properties
SEVERE [com.codename1.actions.OpenGuiBuilderAction]: The GUI file doesn't exist!
WARNING [org.openide.filesystems.Ordering]: Found same position 100 for both Loaders/application/res/Actions/org-openide-actions-OpenAction.shadow and Loaders/application/res/Actions/sep-1.instance
WARNING [org.netbeans.modules.java.JavaTemplateAttributesProvider]: No classpath was found for folder: C:\Users\joshua\Documents\NetBeansProjects\TestGui1@b78894d2:1aed2d64
WARNING [org.openide.WizardDescriptor]
java.lang.StringIndexOutOfBoundsException: String index out of range: -4
    at java.lang.String.substring(String.java:1919)
    at com.codename1.NewGuiBuilderWizardIterator.instantiate(NewGuiBuilderWizardIterator.java:95)
    at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1046)
    at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:605)
    at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:439)
    at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:248)
    at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:160)
    at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1629)
    at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1570)
    at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:92)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2257)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

Upvotes: 1

Views: 131

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

You need to select a package when you do this and not the top level project since the code won't recognize that situation and won't know where to place the GUI file.

Notice that since an XML GUI file is created in the background, refactoring after the fact won't work well so this isn't something we should generally fix.

Upvotes: 0

Related Questions