We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi guys please i need help, i am actully workng a monoploy game development and i have everything set but I have this error message while I run the application:
Using this database: C:\Users\-\Desktop\Processing\-\data\-.db
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.jbox2d.dynamics.World.<init>(Lorg/jbox2d/collision/AABB;Lorg/jbox2d/common/Vec2;Z)V
at fisica.FWorld.<init>(Unknown Source)
at fisica.FWorld.<init>(Unknown Source)
at sheergrace.setup(sheergrace.java:203)
at processing.core.PApplet.handleDraw(PApplet.java:2281)
at processing.opengl.PJOGL$PGLListener.display(PJOGL.java:799)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:590)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:574)
at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:1218)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1036)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:911)
at javax.media.opengl.awt.GLCanvas$10.run(GLCanvas.java:1229)
at javax.media.opengl.Threading.invoke(Threading.java:193)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:492)
at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:546)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
Already called beginDraw()
Using this database: C:\Users\-\Desktop\Processing\-\data\-.db
TuioClient: failed to connect to port 3333
java.lang.NullPointerException
at processing.mode.java.runner.Runner.findException(Runner.java:926)
at processing.mode.java.runner.Runner.reportException(Runner.java:871)
at processing.mode.java.runner.Runner.exceptionEvent(Runner.java:797)
at processing.mode.java.runner.Runner$2.run(Runner.java:686)
Answers
https://forum.Processing.org/two/discussions/tagged/nosuchmethoderror
Just interesting, why you need Fisica for a monopoly game?
Ater what do you think?
Maybe you can show a part of code where you get this error? Do you use Processing 3?
am using 2.1 and this error pops up while I try to run
//Import Libraries import TUIO.*; import ddf.minim.*; import gifAnimation.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import fisica.*; import processing.opengl.*; import java.util.*; //Create instances of the objects imported; Minim minim; SQLite db; AudioPlayer sound; WaveformRenderer waveform; FWorld world; String msg = ""; PFont font; HashMap symbols=new HashMap(); PFont f; PFont Bf; PFont BfB; TuioProcessing tuioClient; int GAME_STATE, qInc, scorePoint, screenID; HashMap<String, Integer> gameSettings; boolean timerIsset = false; boolean isPaused = false; boolean isStarted = false; boolean dummy = false, inPlay = false;
int highscore;
Timmer countDown, pauseMoment;
int introTimer, checkStatus, countPlay, freezeMoment, onQuestion, currentP1LocationX, currentP1LocationY;
int[] playerOneMarkers = { p1puzzlepiece1,p1puzzlepiece2,p1puzzlepiece3,p1puzzlepiece4}; int[] playerTwoMarkers = { p2puzzlepiece1,p2puzzlepiece2,p2puzzlepiece3,p2puzzlepiece4};
PImage[] qLvl1 = new PImage[3]; PImage[] qLvl2 = new PImage[5]; PImage highscoreimg;
PImage lvlBg, intro, intro2, intro3, selectPlayers, menuBg, puzzBg; int[] qP1Ans = {164,213,30}; int[] qP2Ans = {210,205,167};
int[] qLvl2Ans = {4,3,11,10,1};
int[] qTaken = new int[0];
final static short p1puzzlepiece1 = 1; //192; final static short p1puzzlepiece2 = 2; //193; final static short p1puzzlepiece3 = 3; //199; final static short p1puzzlepiece4 = 4; //198;
final static short p2puzzlepiece1 = 12; final static short p2puzzlepiece2 = 22; final static short p2puzzlepiece3 = 32; final static short p2puzzlepiece4 = 42;
int GAME_X = 800; int GAME_Y = 600;
PImage[] images = new PImage[4];
boolean[] monitor = {false,false,false,false}; cuadro piezas[]; int dragged_item,grid_x=532,grid_y=350; boolean config_inicial, soundPlay=false; float offset;
boolean donateMode = false; String scoreFile[]; int spot=0, i=0, q=0, a, newScore, right, mode, _players, playerTurn2, id, turn=0, movesMade=0, nextPlayer=0;
int x=-10, y=-10; //for initial hiding of icons //float countdown=0, timer=0; boolean winner = false, play = false, timeUp=false; String lastInput = new String(); String currentInput = new String(); String statusIcon,question, theAnswer, address, answerSupplied, newName, statusMessage=""; Player player1, player2, player3, player4; boolean show_money = false; float controlAngle; int selection, selection_money, angleTimer = 0, showTime, choice=0, stage=0; String spotName =""; String[]playerName; String[] questionLoader; String[] fullquestion; String[]playerIcon; int[]where; int[]money; int owed = 100; String comment = ", its your turn to show your batch "; String money_comment =""; String[]position; Gif anim_bg1; Gif loading; int actualLevel; int playturn; String cImage_1; int start=0,stop; int track1=1, track2=1; int borrowed = 0, curmoney=0; float level; int levetTime=0, moneyMode=0, checkmoney = 0; PImage slider; float sliderPosX,sliderPosY; int count=1,count2=1,count3=1; float handX=-5000,handY=-5000; float handX1=-5000,handY1=-5000; float handX2=-5000,handY2=-5000; boolean show_comment; int doSpot = 0;
Menu tool; Timer timer;
void setup(){ symbols.put(0, "0"); symbols.put(1, "1"); symbols.put(2, "2"); symbols.put(3, "3"); symbols.put(4, "4"); symbols.put(5, "5"); symbols.put(6, "6");
gameSettings = new HashMap<String, Integer>(); GAME_STATE = 3; //gameSettings.put("levelOn", 1); countPlay = 0; qInc = 0; scorePoint = 20; freezeMoment = 0;
onQuestion = 1;
gameSettings.put("levelOneSec", 15); gameSettings.put("levelTwoSec", 30); gameSettings.put("levelThreeSec", 30);
gameSettings.put("questionTimeUp", 0); // 1 = true 0 = false gameSettings.put("playerNo", 1); // 1 - single player 2 - multi-player gameSettings.put("mode", 0); // Mode determines if answer marker is required or not gameSettings.put("levelOn", 1); // 0 = false 1 = true gameSettings.put("currentLevel", 1); // By default Level 1
gameSettings.put("playerOneScore", 0); gameSettings.put("playerTwoScore", 0); //textFont(mario); checkStatus = 200;
}
void draw() {
{ tool.display(); tool.components(); } if(mode == 0) { world.step(); world.draw(this); }
if(tool.getLevel()== 1) { background (loadImage("players.png")); fill(255);
}
if (mode==2) { if (q<_players) {
}
if (mode==4 || mode ==5) { textFont(f,20); background (loadImage("Board"+_players+".png")); if(show_money == true) { text(""+borrowed, 225, 505); spotName= "Charity"; timer.DisplayMoneyControl(); } for (i=0;i<_players;i++) { fill(230, 32, 51); smooth(); text (playerName[i], (190+i*200), 135); image(loadImage(playerIcon[i]), (150+(i*190)), 110); text (money[i], (220+i*190), 160); }
}
if(mode == 6) { //Load questions heres
}
if(mode == 10){
if( inPlay == false ) { inPlay = true; piezas = new cuadro[4]; images[0] = loadImage("puzzle/p2.png"); images[1] = loadImage("puzzle/p1.png"); images[2] = loadImage("puzzle/p4.png"); images[3] = loadImage("puzzle/p3.png");
}
}
void activate() { if(mode == 0) { if(id == 1) instruction(); // if(id == 36) gameHome(); if(id == 5) exit(); }
if (mode==1) { tool.setLevel(4); timer.stop(); _players= selection; playerSettings(); }
if(checkmoney== 1) {
// int fina = curmoney - borrowed; // money[playturn] = fina; money_comment ="Thank you for your donation.";
show_money=false; //println(fina); timer.stop(); mode = 5; checkmoney= 0; }
if (mode==4) {
}
if (mode==5) { if (turn==0){if (id==28){turn=1;mode=4; play=true; statusIcon= "go.png"; comment = ", Thank you for showing your batch. You can now toss your dice!" ;}} if (turn==1){if (id==73){turn=2;mode=4; play=true; statusIcon= "go.png"; comment = ", Thank you for showing your batch. You can now toss your dice!" ;}} if (turn==2){if (id==15){turn=3;mode=4; play=true; statusIcon= "go.png"; comment = ", Thank you for showing your batch. You can now toss your dice!" ;}} if (turn==3){if (id==16){turn=4;mode=4; play=true; statusIcon= "go.png"; comment = ", Thank you for showing your batch. You can now toss your dice!" ;}}
}
if (mode==6 && timeUp==false) { if(id>0 && id<5) { checkAnswer(); } }
}
void audios(String music){ if(count==1 && tool.getAudio()==true) { sound = minim.loadFile(""+music+"", 2048); sound.addListener(waveform); sound.play(); count+=1; } }
void checkSpot(int playerTurn) { playerTurn2=playerTurn;
if (where[playerTurn]==4 || where[playerTurn]==15 || where[playerTurn]==27) { timer.start(); if (db.connect()) {
db.query( "SELECT * FROM sl WHERE number = 3 ORDER BY RANDOM( ) LIMIT 1" ); question = db.getString("question")+"|"+db.getString("optionA")+"|"+db.getString("optionB")+"|"+db.getString("optionC")+"|"+db.getString("optionD")+"|"+db.getString("answer"); }
} else if(where[playerTurn]==2 || where[playerTurn]==10 || where[playerTurn]==17 || where[playerTurn]==26) { textFont(BfB); textSize(20); fill(255, 0, 0); money_comment = "OOps!, "+playerName[nextPlayer]+ " Save a child in africa, please donate!"; println(money_comment); show_comment = false; donateMode = true; mode = 5;
} else if(where[playerTurn]== 7 || where[playerTurn]== 21) { spotName =""; statusMessage = playerName[nextPlayer]+ " you got yourself into Jail.!";
} else if(where[playerTurn]==5 || where[playerTurn]==14 || where[playerTurn]==21) { println("Pay for your school bus ride home"); // mode = 10; money_comment = playerName[nextPlayer]+ " We hope you enjoy your ride!"; spotName ="";
} else if(where[playerTurn]==19 || where[playerTurn]==28 ) { mode = 10; println("Initiate the puzzle game"); } else if(where[playerTurn]==1 ||where[playerTurn]==3 || where[playerTurn]==6 || where[playerTurn]==8 || where[playerTurn]==9 || where[playerTurn]==11 || where[playerTurn]==12 || where[playerTurn]==13 || where[playerTurn]==16 || where[playerTurn]==18 || where[playerTurn]==20 || where[playerTurn]==23 || where[playerTurn]==24 || where[playerTurn]==25) { if(turn == 0 || turn == 1) { setDebitMoney(0, 50); }
} else if(where[playerTurn]==29) { println("GO!! Go!! GO!!"); mode = 5; } else { mode = 5; } }
void rollDice() { play = false; comment = ", its your turn to show your batch "; statusIcon = "stop.png"; if (_players==2) { if(where[0]>=where[1]) { position[0]=playerName[0];position[1]=playerName[1]; } else { position[0]=playerName[1];position[1]=playerName[0]; } }
if (_players==3) { if(where[0]>=where[1]) {
if (where[0]>=where[2]) { position[0]=playerName[0];
} else { if(where[1]>=where[2]) { position[0]=playerName[1]; if (where[2]>=where[0]) { position[1]=playerName[2]; position[2]=playerName[0]; } else { position[1]=playerName[0]; position[2]=playerName[2]; } } else { position[0]=playerName[2]; position[1]=playerName[1]; position[2]=playerName[0]; } }
} if (_players==4) { int w=where[0], x = where[1],y= where[2], z=where[3]; int [] sortList={w,x,y,z}; sortList = sort(sortList); sortList = reverse(sortList); for(i=0;i<4;i++) { if(sortList[i]==w)position[i]=playerName[0]; if(sortList[i]==x)position[i]=playerName[1]; if(sortList[i]==y)position[i]=playerName[2]; if(sortList[i]==z)position[i]=playerName[3]; } } }
void instruction() { background (loadImage("instruction.gif")); } void gameHome() { mode = 1; background (loadImage("players.png")); }
void playGame() { background (loadImage("Board"+_players+".png")); // sound.close(); mode = 5; rollDice(); }
void playerSettings() { playerName = new String [_players]; playerIcon = new String [_players]; where = new int [_players]; position = new String [_players];
for (i=0;i<_players;i++) { playerIcon[i]="image"+i+".png"; }
mode = 2;
if (_players==2) { player1= new Player(playerName[0],playerIcon[0], 0, 0); player2= new Player(playerName[1],playerIcon[1], 0, 0); } if (_players==3) { player1= new Player(playerName[0],playerIcon[0], 0, 0); player2= new Player(playerName[1],playerIcon[1], 0, 0); player3= new Player(playerName[2],playerIcon[2], 0, 0); } if (_players==4) { player1= new Player(playerName[0],playerIcon[0], 0, 0); player2= new Player(playerName[1],playerIcon[1], 0, 0); player3= new Player(playerName[2],playerIcon[2], 0, 0); player4= new Player(playerName[3],playerIcon[3], 0, 0); } }
void highScore(String bgImage) { background (loadImage(bgImage)); scoreFile=loadStrings("highscores.txt"); for(int i=0; i<5; i++) { fill(255); text(scoreFile[i+5], 480, 550+(i42)); text(scoreFile[i]+ " RS", 570, 550+(i42)); fill(0); } }
void keyPressed() { if (mode==2) { if (q<_players) { if(key == ENTER) { playerName[q]= currentInput; position[q]=playerName[q]; //just assigning default positions to each player in the order the enter thier names currentInput=""; q++; }
} }
public int getMoney(int playa) { int moneyy = money[playa]; return moneyy; }
public void setDebitMoney(int playa, int moneys) { int moneyy = money[playa]; int reserve = moneyy - moneys; money[playa] = reserve; }
public void creditMoney(int playa, int moneys) { int moneyy = money[playa]; int reserve = moneyy + moneys; money[playa] = reserve; }
void addTuioObject(TuioObject tobj){ id = tobj.getSymbolID(); if (symbols.containsKey(id))activate(); } void removeTuioObject(TuioObject tobj){ if(tobj.getSymbolID()==0) { handX=-5000; handY=-5000; }
if(tobj.getSymbolID()== 38) { show_money = false; println("iIts working"); }
if( GAME_STATE == 3 && mode == 10) { puzzleReleased( tobj.getSymbolID() ); }
} void updateTuioObject (TuioObject tobj) {
if(tool.getLevel()==0) { handX=tobj.getScreenX(width)-50; handY=tobj.getScreenY(height); if(tobj.getSymbolID()==0) { if(tobj.getScreenX(width)-50>588) { sliderPosX=585; tool.setLevel(0.5); } else if(tobj.getScreenX(width)-50<350) { sliderPosX=350; } else { sliderPosX=tobj.getScreenX(width)-50; } if((tobj.getScreenX(width)-50>=0 && tobj.getScreenX(width)-50<=105) && (tobj.getScreenY(height)>=550 && tobj.getScreenY(height)<=680)) { tool.setLevel(0.8); } } }
controlAngle = tobj.getAngleDegrees(); if ((id==7) && (controlAngle > 0 && controlAngle <=120)) { if(tool.getLevel()==1) { selection = 4;
}
if ((id==7) && (controlAngle > 120 && controlAngle <=210)) { if(tool.getLevel()==1) { selection = 3;
}
{ if(tool.getLevel()==1) { selection = 2;
}
//Money for first player if(id == 8 && donateMode == true) { show_money = true; if(controlAngle >0 && controlAngle<= 45) { borrowed = 300; moneyMode =0; timer.start();
//Money for second player if(id == 9 && donateMode == true) { show_money = true; if(controlAngle >0 && controlAngle<= 45) { borrowed = 300; moneyMode =1; timer.start(); curmoney = getMoney(1); } if(controlAngle >45 && controlAngle<= 90) { borrowed = 250; moneyMode =1; timer.start(); curmoney = getMoney(1); }
//println(controlAngle); //println(turn); } void addTuioCursor(TuioCursor tcur) { } void updateTuioCursor (TuioCursor tcur) { } void removeTuioCursor(TuioCursor tcur) {
} void refresh(TuioTime bundleTime) { }
That is too big piece of code and not formatted right...
The code you posted is a waste of time, as Ater said it is too big and not properly formatted for this forum (how to format code). Even then there is no chance of running the code.
First thing the statement
size (1022, 763, P3D);
MUST be the FIRST statement inside setup so I would try that first although I am not convinced it will solve the problem.
In the stack trace there are 2 things of interest
Thing 1
java.lang.NoSuchMethodError: org.jbox2d.dynamics.World.(Lorg/jbox2d/collision/AABB;Lorg/jbox2d/common/Vec2;Z)V at fisica.FWorld.(Unknown Source) at fisica.FWorld.(Unknown Source) at sheergrace.setup(sheergrace.java:203) at processing.core.PApplet.handleDraw(PApplet.java:2281) at ...
Putting on my Sherlock Holmes hat on and doing a bit of investigating we can reach some conclusions
would indicate that your sketch is called 'sheergrace' and that the exception was thrown in the
setup()
method. Nextwould indicate that it occurred in the constructor for the FWorld class in the fiscia package so it was thrown when executing this statement in your code.
world = new FWorld();
this calls the constructor in the parent class
org.jbox2d.dynamics.World
. There is also a mention of the AABB class which defines a rectangle using upper-left and bottom-right corners and I believe is used to define the world limits and uses thewidth
andheight
variables as defined in the size(...) statement. Hence moving the statement to the start of setup might help.Thing 2
Obviously a problem but I don't know if causes the proble.
Finally
In your code I noticed that you are loading images inside the draw() method. This is NOT recommended because it will attempt to load them 60 times a second. Load them in setup and use them in draw.
REPOST: https://forum.Processing.org/two/discussions/tagged/nosuchmethoderror
Expecting this time folks gonna pay attention! 8-|
Yes it could be that the libraries you use are incompatible with the version of Processing you are using.
java.lang.NoSuchMethodError: org.jbox2d.dynamics.World.<init>(Lorg/jbox2d/collision/AABB;Lorg/jbox2d/common/Vec2;Z)V
Still no near capable of deciphering such debug lines.
I believe
V
meansvoid
. If by any chance that constructor depends on any PVector method which returnsvoid
, it's not gonna find any in P3! :-horg.jbox2d.dynamics.World
does not use PVector this library has its own vector class Vec2Maybe some of Vec2's methods might end up invoking PVector methods in some cases. Who knows? :-/
I do and they don't.
The problem is almost certainly the fisica library it was last updated in March 23 for PS 2.0b8 the OP needs to go back to PS2
OK just to help out I will explain
org.jbox2d.dynamics.World.<init>(Lorg/jbox2d/collision/AABB;Lorg/jbox2d/common/Vec2;Z)V
L means object and Z boolean so it is looking for a constructor with the following signature
World(AABB aabb, Vec2 vec, boolean bool)
HTH :)
Indeed you know whether Vec2 surreptitiously invokes PVector methods or not since you're the author of Shapes3D! :-j
Thx for the detail decoding of the bug message.
Somehow I already was suspicious
Z
meantboolean
. B/c I've recently read about Jython:http://www.IBM.com/developerworks/java/tutorials/j-jython2/j-jython2.html#appcharcode
And in order to create arrays there, we need to specify those letters in order to match Java's type. :P
Vec2 is part of the JBox2D library (org.jbox2d.common.Vec2), which I didn't author. It is a Java port of the C++ Box2D library, it is not a port for Processing which is why I know it didn't use PVector in its code. The fisica library is a Processing wrapper for JBox2D so probably does use PVector, which is causing a problem for the OP.
The Shapes3D library was created specifically for Processing and I used PVector throughout.
@asangajnr you need to use Processing 2 if you want to use the fisica library
thanks guys. I have that part out. this is the current error
processing.app.SketchException: The function registerDispose(SQL) does not exist.
You need to post more of the stacktrace to find out where it is expecting to find the method.
registerDispose() was
@ Deprecated
in Processing 2 and completely removed in Processing 3!Since Processing 2, all individual "register" type methods were replaced by 1 registerMethod(). :-B
https://forum.Processing.org/two/discussions/tagged?Tag=registerdispose()
@asangajnr At least by now you should have posted the formatted code, if only for the benefit of others. Remember, there might others also interested in the post, and the forum relies on everyone contributing whatever they can to it.
And BTW, could you help me in developing a Monopoly project? I am working on the same :)