Page 1 of 1

ArrayList LinkedList Vector missing?

Posted: Sat Apr 12, 2008 1:00 am
by MerickOWA
Trying to use these in my bot and getting exceptions when i run it in non-native mode


at org.hacker.engine.war.HackVMWarSpinalCord.think(HackVMWarSpinalCord.java:137)
at org.hacker.engine.war.Faction.unitThink(Faction.java:190)
at org.hacker.engine.war.Faction.think(Faction.java:114)
at org.hacker.engine.war.WarModel.step(WarModel.java:77)
at org.hacker.engine.GameUI.stepToIt(GameUI.java:166)
at org.hacker.engine.GameUI$5.run(GameUI.java:99)
Apr 11, 2008 8:56:36 PM ojvm.machine.ControlUnit makeAndThrow
INFO: new exception: java.lang.LinkageError, msg: File java\util\LinkedList.class not found in: lib/rt.jar

ArrayList does the same. I tried using Vector and got a wierder message

at org.hacker.engine.war.WarModel.step(WarModel.java:77)
at org.hacker.engine.GameUI.stepToIt(GameUI.java:166)
at org.hacker.engine.GameUI$5.run(GameUI.java:99)
Apr 11, 2008 8:58:41 PM ojvm.machine.ControlUnit makeAndThrow
INFO: new exception: java.lang.LinkageError, msg: File [Ljava\lang\Object;.class not found in: lib/rt.jar


what container class for a simple list with add() and size() can i use?

Posted: Sat Apr 12, 2008 7:33 am
by adum
vector is the only container class currently supported. i can't say it's thoroughly tested, but i have tried it before and made it work. that's odd about the missing Object class. i'm not sure why that would happen. i'll try to look into this.

adum

Posted: Sat Apr 12, 2008 8:17 pm
by MerickOWA
Thanks. I just went ahead and implemented my own List class. Just thought it was odd because HashMap worked for me with no problems.

Have a working bot now! Love the game! FEAR THE DEFENDERS!

Posted: Sun Apr 13, 2008 4:21 am
by adum
that's very interesting, HashMap worked for you under the non-native mode? i didn't think that worked yet =/

i'll look out for defender =)

adum

Posted: Thu May 29, 2008 7:31 pm
by Rotekian
Oops, looks like I should have tested my bot non-natively before I submitted it.

Edit: Changing my Vector to a HashMap seems to have made it less broken. Now I just have a null non-null error.

Posted: Mon Nov 10, 2008 6:48 pm
by kellpete
I really wonder how you made the Vector class work! I always get a crash (only in non-native mode). Are there any tricks which I have to know? Should I avoid the Vector class because of instability anyway?

When I add the following to e.g. Genghis:
class inner {
int x;
}
public java.util.Vector<inner> vecTest = new java.util.Vector<inner>();

Then I get the crash below, which looks very similar to what MerickOWA first reported

Hoping to upload a bot soon... :twisted:
Peter

10.11.2008 19:41:29 ojvm.machine.ControlUnit makeAndThrow
INFO: new exception: java.lang.LinkageError, msg: not found: Object;.class
ojvm.data.JavaException
at ojvm.operations.Exceptions.makeAndThrow(Exceptions.java:40)
at ojvm.machine.ControlUnit.makeAndThrow(ControlUnit.java:216)
at ojvm.operations.BytecodeInterpreter.visit_checkcast(BytecodeInterpreter.java:314)
at ojvm.loading.instructions.Ins_checkcast.accept(Ins_checkcast.java:31)
at ojvm.machine.ControlUnit.run(ControlUnit.java:169)
at org.hacker.engine.war.HackVMWarSpinalCord.initClass(HackVMWarSpinalCord.java:83)
at org.hacker.engine.war.HackVMWarSpinalCord.<init>(HackVMWarSpinalCord.java:55)
at org.hacker.engine.war.HackVMWarSpinalCordFactory.createSpinalCord(HackVMWarSpinalCordFactory.java:42)
at org.hacker.engine.war.Faction.addUnit(Faction.java:46)
at org.hacker.engine.war.WarModel.genFactions(WarModel.java:60)
at org.hacker.engine.war.WarModel.<init>(WarModel.java:50)
at org.hacker.engine.war.WarChooser.runIt(WarChooser.java:126)
at org.hacker.engine.Chooser$4.actionPerformed(Chooser.java:160)
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.plaf.basic.BasicButtonListener.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)
failed to call init