Java Question cannot find symbol

D

Deleted member 103

Guest
Hi,

what does this error message?

Compiling code. 0.00
Generating R file. 0.00
Compiling generated Java code. Error
javac 1.6.0_20
src\fg\test1\main.java:170: cannot find symbol
symbol : class test
location: class fg.test1.main
test _testlib = null;
^
1 error


My Code:
B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
   Dim testlib As test
   Log("testlib.Width=" & testlib.Width)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Java-Code:
B4X:
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

@ShortName("test")
@Version(1.0f)
@Author("Filippo")
/**
* My Comment.
*/
public class test {
   int var1;
   
   public test(){
      var1=0;
   }
   
   public int getWidth() {
        return var1;
   }
   public void setWidth(int value) {
      var1=value;
   }
   
}
 
D

Deleted member 103

Guest
You have put test.jar with test.xml in your additional libraries folder and selected your library in the Libraries tab? Does the IDE Intellisense know about it?
I think so.:confused:
 

Attachments

  • Test-Class.jpg
    Test-Class.jpg
    25.4 KB · Views: 545
D

Deleted member 103

Guest
It you haven't solved it post the test1 project (export as zip) and the jar and xml and I'll take a look.
find attached the 2 projects.
 

Attachments

  • B4A_test1.zip
    4.7 KB · Views: 515
  • Java.fg.test.zip
    4.1 KB · Views: 484
Last edited by a moderator:

agraham

Expert
Licensed User
Longtime User
I don't think your Eclipse project is set up right. test.java is not in a package but is a file immediately under src.

I created a new Eclipse project, put your source into it and it compiles and runs fine. Right click on the src folder in Eclipse -> New -> Class. Enter a package name, I used "anywheresoftware.b4a.filippo.test", and the class name "Test". Copy the code in and it should then work OK.
 
Top