Chicken Wing Posted September 15, 2015 Share Posted September 15, 2015 Hi guys, I am trying to make a safe-cracker script, I was cleaning up my projects so I copied them all into one workspace for all my osbot stuff, ever since I get this error at runtime when I run my jar file (there are no compiler errors) [ERROR][09/15 03:45:44 PM]: Uncaught exception! java.lang.NoSuchMethodError: core.Task.<init>(Lcore/SafeCracker;)V at tasks.ClickSafe.<init>(ClickSafe.java:14) at core.SafeCracker.onStart(SafeCracker.java:59) at org.osbot.rs07.event.ScriptExecutor.onStart(lj:110) at org.osbot.rs07.event.ScriptExecutor.start(lj:194) at org.osbot.prN.run(cp:367) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Last time I fixed it by deleting everything and making a new project, but now even if I clean all the class files and rebuild the project I still get this error. Here is the src folder: http://www.mediafire.com/download/ljcgco1kwmro75z/New_Compressed_%28zipped%29_Folder.zip Not sure what to do anymore Quote Link to comment Share on other sites More sharing options...
Alek Posted September 15, 2015 Share Posted September 15, 2015 Are you using notepad++ to compile or something? Your IDE should be giving you some pretty big hints as to what method doesn't exist. Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 Are you using notepad++ to compile or something? Your IDE should be giving you some pretty big hints as to what method doesn't exist. That error log is from osbot when I run the script, and Im using eclpise, which is showing no errors, not even warnings. Quote Link to comment Share on other sites More sharing options...
Alek Posted September 15, 2015 Share Posted September 15, 2015 Ah, didn't see it was an uncaught exception. Are you sure you are compiling against the latest version of OSBot (not using against, compiling against)? Quote Link to comment Share on other sites More sharing options...
Apaec Posted September 15, 2015 Share Posted September 15, 2015 re-create the project and move over the class files Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 Ah, didn't see it was an uncaught exception. Are you sure you are compiling against the latest version of OSBot (not using against, compiling against)? Im using the latest version (2.3.114) in my build path Quote Link to comment Share on other sites More sharing options...
Alek Posted September 15, 2015 Share Posted September 15, 2015 It also shows you which lines:at tasks.ClickSafe.<init>(ClickSafe.java:14)at core.SafeCracker.onStart(SafeCracker.java:59)What methods are you using on those lines? Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 (edited) It also shows you which lines: at tasks.ClickSafe.<init>(ClickSafe.java:14) at core.SafeCracker.onStart(SafeCracker.java:59) What methods are you using on those lines? 13 public ClickSafe(SafeCracker sA) { 14 super(sA); 15 } 59 Collections.addAll(nodes, new ClickSafe(this), new EatFood(this), new CloseBank(this), 60 new DepositGems(this), new OpenBank(this), new ReturnToCracking(this), new WithdrawFood(this)); I posted the src folder link btw EDIT: btw if I remove the clicksafe object, the error will just show for EatFood instead at the same place Edited September 15, 2015 by Chicken Wing Quote Link to comment Share on other sites More sharing options...
Alek Posted September 15, 2015 Share Posted September 15, 2015 I'm taking it that you didn't write that task system yourself? You might want to look into using enum states until you get a little more familiar with Java. In the meantime check out some of this stuff: https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html https://docs.oracle.com/javase/tutorial/java/IandI/super.html https://docs.oracle.com/javase/tutorial/java/concepts/interface.html 2 Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 I'm taking it that you didn't write that task system yourself? Well, I used this tutorial to write it: http://osbot.org/forum/topic/48284-javatutorial-how-to-get-a-single-stage-node-framework-intermediate/ , and it works, I have a script on the sdn which uses it and it works fine, in fact the code was working fine before, its just when I copied it over from another project into a new eclipse project The comparator stuff was just something I was trying out, Its not used re-create the project and move over the class files Move which class files to where? Quote Link to comment Share on other sites More sharing options...
fixthissite Posted September 15, 2015 Share Posted September 15, 2015 (edited) You should show your workspace hierarchy. When this happens due to relocating, there's a good chance another Task binary file is interfering (one which does not have that constructor, but maybe a constructor which accepts a different script or maybe has no parameters). Since a ClassNotFoundException was not thrown, there is definitely a Task type, it just doesn't contain the constructor you need. Do you have any other Task files in the workspac/project that you moved the script to? Edited September 15, 2015 by fixthissite Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 (edited) https://i.gyazo.com/a1b7d0948c9f8600e389c8c436367b0a.png You should show your workspace hierarchy. When this happens due to relocating, there's a good chance another Task binary file is interfering (one which does not have that constructor, but maybe a constructor which accepts a different script or maybe has no parameters). Since a ClassNotFoundException was not thrown, there is definitely a Task type, it just doesn't contain the constructor you need. Do you have any other Task files in the workspac/project that you moved the script to? This is all thats in the workspace now and it still gives the error I'm taking it that you didn't write that task system yourself? You might want to look into using enum states until you get a little more familiar with Java. In the meantime check out some of this stuff: https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html https://docs.oracle.com/javase/tutorial/java/IandI/super.html https://docs.oracle.com/javase/tutorial/java/concepts/interface.html I understand all those stuff, I understand how the task system works, not sure what you mean by enum states though so ill check that out, thank you for your help though I appreciate it Edited September 15, 2015 by Chicken Wing Quote Link to comment Share on other sites More sharing options...
fixthissite Posted September 15, 2015 Share Posted September 15, 2015 That's really strange. I'm not sure how the client handles classloading for scripts, so this is a long shot, but:Is this a local script? Do you have other local scripts? Do those other local scripts use the same package hierachy as this one, and possibly contain a core.Task? Try temporarily removing any other local scripts you may have. This is just to make sure that in the case of the classloader loading types of other local scripts, none of those script's types conflict with the one you are testing. It would also be helpful to elaborate more on the situation. Do you happen to run any other scripts before running this one? Has this happened to you before (your title says again, so...), and if so what was the issue and was it with this same script? It's easier to help if you give as much detail as possible Quote Link to comment Share on other sites More sharing options...
Chicken Wing Posted September 15, 2015 Author Share Posted September 15, 2015 (edited) That's really strange. I'm not sure how the client handles classloading for scripts, so this is a long shot, but: Is this a local script? Do you have other local scripts? Do those other local scripts use the same package hierachy as this one, and possibly contain a core.Task? Try temporarily removing any other local scripts you may have. This is just to make sure that in the case of the classloader loading types of other local scripts, none of those script's types conflict with the one you are testing. It would also be helpful to elaborate more on the situation. Do you happen to run any other scripts before running this one? Has this happened to you before (your title says again, so...), and if so what was the issue and was it with this same script? It's easier to help if you give as much detail as possible I have just fixed this whole problem by deleting all my workspaces (and projects), and re-downloading eclipse, the script runs fine now as it should... But to answer your questions, it was a local script, and there were other scripts containing a core.task, but the other core.task's had different constructors Ill see if adding more projects now breaks anything EDIT: It doesnt. I don't know why this happened but its fixed now and I have no (exact) idea why Edited September 15, 2015 by Chicken Wing Quote Link to comment Share on other sites More sharing options...
fixthissite Posted September 15, 2015 Share Posted September 15, 2015 I have just fixed this whole problem by deleting all my workspaces (and projects), and re-downloading eclipse, the script runs fine now as it should... But to answer your questions, it was a local script, and there were other scripts containing a core.task, but the other core.task's had different constructors Ill see if adding more projects now breaks anything Yes, the other Tasks having different constructors could have caused the problem. If one of those tasks had higher priority in the classpath than the Task you wanted (assuming they were both loaded in for some reason), you would get that error, since they do not contain the constructor you want (instead, they contain one for a different script) Quote Link to comment Share on other sites More sharing options...