Error Importing Class

I found a module that contains a class that I would like to contain in my module. When I try to import it I get errors. I don’t think I’m doing it right but I cant find any instructions on how to import in the documentation.

This is what I did, I opened the module that I want to take the class from in winrar. I found the class in a folder called com/fightingchaos/VASSAL/counters/Group.class.
I took the Group.class file and placed it in the root of the module I’m moving it too.
Than I edit the module in the Vassal editor and try to import “Group” into the [Module] section.
Than I get an error that says:

java.lang.NoClassDefFoundError: Group (wrong name: com/fightingchaos/VASSAL/counters/Group)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at VASSAL.tools.DataArchive.findClass(DataArchive.java:370)
	at VASSAL.tools.DataArchive.loadClass(DataArchive.java:346)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at VASSAL.configure.ConfigureTree.importConfigurable(ConfigureTree.java:770)
	at VASSAL.configure.ConfigureTree$5.actionPerformed(ConfigureTree.java:418)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

I noticed it mentions that wrong name thing, what does that mean? do I need to redo any code? Please let me know what the issue is or if you need more information.

You are importing it wrong.
You do not want to move the file from its folder structure.
The entire folder structure should go into your module as is.
You then want to import

com.fightingchaos.VASSAL.counters.Group

At least, I think this is correct :slight_smile:

Post generated using Mail2Forum (mail2forum.com)

thanks for your quick reply I will try this now

I tried this and it says the imported class is not configurable, and cannot be imported this way.

I right clicked the root folder Title[Module], and attempted to import the class there, do you know what I did wrong and the correct way to import the class?

What would be better is some kind of documentation that I can reference from now on.

Try contacting the module designer, asking for permission to use the class and for instructions on how to incorporate it in your module. It may require a hand-built buildfile entry which will be next to impossible to derive without the help of the author.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I totally forgot about the source documentation that was released with the module. OK so in the documentation it says this:

EmpiresCommandEncoder

A startup command encoder for VASSAL which includes code for creation of GroupRotator GamePieces in your module. The class is used in the VASSAL buildfile

how do I import/include this in the module?

Have a look at the buildfile of the module you are stealing the code from. Copy the buildfile entry that references EmpiresCommandEncoder and copy the class directory structure that includes that class.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I’m pretty sure the fightingchaos team is completely diminished. I was on the forums and they don’t seem to have been working on it for years. If you know otherwise please let me know.

And I’m not stealing the code they left it open source.

I quote from the website http://fightingchaos.com/vassal/battle/index.html:

I’m sure it is, but you chose not to respond to my previous posts about contacting the authors and requesting permission, so I assumed the worst. Sorry for any offense.

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)