java build error

dagnabitboy

Active Member
Licensed User
Longtime User
my small test program will ultimately be a "hex file viewer". There are 3 subs that convert an integer to hex strings, those are tested and work. the output is intended to have a typical column of numbers with the hex address on the left, then 16 hex values following, on each line. At the moment I have a simple loop to display things and work out some concepts. When I compile I get a java build error:

Compiling code. 0.00
Generating R file. 0.00
Compiling generated Java code. Error
B4A line: 38
txt = txt & CRLF
javac 1.6.0_21
src\com\phil\gpdevel\main.java:254: not a statement
}_n;
^
1 error

Is there an issue with the structure of my code? If I comment out the offending line, the error moves to a different line!

Here is my code:
B4X:
' Note: this is a general purpose code testing program

'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.
   Dim label1 As Label         
   Dim txt As String
   Dim n, m, addr As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
   label1.Initialize("label1")
   label1.Color=Colors.LightGray
   label1.TextColor=Colors.Black
   label1.Typeface=Typeface.MONOSPACE
   
   activity.AddView(label1,10dip,10dip,300dip,200dip)
   activity.Title="general code test"
   txt = "Hex data values" & CRLF & CRLF
   m=0
   addr=0
   For n = 1 To 64
      If m = 0 Then
         txt=txt& cvhex6(n-1) & " "
      End If
      txt=txt& cvhex2(n)
      addr=addr+1
      m = m + 1
      If m = 16 Then
         m = 0
         txt = txt & CRLF
      End If
   Next n
   label1.Text = txt
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub cvhex6(nn)
   Dim x As String
   x=Bit.ToHexString(nn)
   Do While x.Length < 6
      x="0" & x
   Loop
   Return x.ToUpperCase
End Sub
Sub cvhex4(nn)
   Dim x As String
   x=Bit.ToHexString(nn)
   Do While x.Length < 4
      x="0" & x
   Loop
   Return x.ToUpperCase
End Sub
Sub cvhex2(nn)
   Dim x As String
   x=Bit.ToHexString(nn)
   Do While x.Length < 2
      x="0" & x
   Loop
   If x.Length > 2 Then
      x = "XX"
   End If
   Return x.ToUpperCase & " "
End Sub

Thanks for taking a look!
 
Top