1

Using Terminal IDE, I am trying to create a custom class with some variables and methods. I went about trying this by creating the custom class as a separate .java file. I then created a second .java file with the main method to test the custom class. Main idea is that after compiling both .java files successfully, and then converting both .class files to DEX format succesfully, when I try to run the java file containing the main method to test the custom class, I get a list of error messages beginning with:

java.lang.ClassNotFoundException: TesterClass in loader com.spartacusrex.spartacuside.external.dexloader.dexclassloader@4071b260...

Why am I getting this? Everything is compiling well and converting to DEX with no errors. I thought that in java in order to create custom classes, the custom class must be its own separate .java file which is exactly what I've done (I even tried putting both classes in the same .java file to see if this would fix the problem but even Terminal IDE gave me an error when I tried doing this saying that the custom class had to be in its own .java file).

If you're wondering, I'm using a Samsung Galaxy Tab 2 running Android 4.1.2 which within the Android versions that the developer says will work with Terminal IDE. If you want to see my code for both .java files, please let me know and I'd be happy to show you what it is I've done so far. Thanks for any help anyone can give.

  • Have you declared "TesterClass" in your manifest ? – Jon Goodwin Oct 09 '16 at 23:07
  • please add code – suku Oct 09 '16 at 23:21
  • Please, post the full exception. Also, do you keep the sources within the `Terminal IDE`'s private directory? – Onik Oct 09 '16 at 23:33
  • @Jon Goodwin NoI haven't declared TesterClass in my manifest. I regret to say I'm a bit of a novice at TerminalIDE (and programming in general for that matter) so frankly, I'm not sure how I would do this. If it's not too much of a hassle, would you please tall me how I would implement/declare my TesterClass in a manifest? Thank you for any direction you can point me to. – Android_Student Nov 23 '16 at 21:42
  • @suko Yes, here's the code for the custom class: public class BankAccount { public BankAccount() { balance = 0; } public BankAccount(double initialBalance) { balance =initialBalance; } public void deposit(double amount) { double newBalance = balance + amount; balance = newBalance; } public void withdraw(double amount) { double newBalance = balance - amount; balance = newBalance; } public double getBalance() { return balance; } private double balance; } – Android_Student Nov 23 '16 at 21:53
  • @suko Hello again, would you please tell me if there a more efficient way I can post my code as trying using these comments completely ruins the formatting and spacing. Thank you. – Android_Student Nov 23 '16 at 21:56
  • Add code to your question(make sure it is relevant) or a link. Are you making an android app, or something different ? How are you running the code ? Activities need to be declared in the manifest (for apps). – Jon Goodwin Nov 23 '16 at 23:32

0 Answers0