Java Question Create lib in Eclipse error

ilan

Expert
Licensed User
Longtime User
hi

i am trying to create a very simple lib in eclipse but i am getting an error while i try to build my app in b4a.

this is the code in the java class:

B4X:
package sagital.net.geo;

import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

@ShortName("geometry")
@Version(value = 1)

public class geometry{

    /*
     * Calculate Cube Surface by his x,y,z
     */
    public double CubeGetSurface(double x, double y, double z) {
        return (((x * y) * 2) + ((x * z) * 2) + ((y * z) * 2));
    }
   
    /*
     * Calculate Cube Volume by his x,y,z
     */
    public double CubeGetVolume(double x, double y, double z) {
        return x*y*z;
    }
   
    /*
     * Calculate Circle Area by his radius
     */
    public double CircleGetArea(double r) {
        return Math.PI * Math.pow(r, 2);
    }
   
    /*
     * Calculate Sphere Surface Area by his radius
     */
    public double SphereGetSurfaceArea(double r) {
        return 4 * Math.PI * Math.pow(r, 2);
    }
   
    /*
     * Calculate Sphere Volume by his radius
     */
    public double SphereGetVolume(double r) {
        return (double) 4/3 * Math.PI * Math.pow(r, 3);
    }
   
    /*
     * Calculate Square Area by his x,y
     */
    public double SquareGetArea(double x, double y) {
          return (x * y);
    }
}

this is the error i get when i compile:

B4A version: 7.01
Parsing code. (0.00s)
Compiling code. (0.03s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.03s)
Compiling debugger engine code. (0.45s)
Compiling generated Java code. (0.57s)
Convert byte code - optimized dex. Error
PARSE ERROR:
unsupported class file version 52.0
...while parsing sagital/net/geo/geometry.class
1 error; aborting

i have followed the tutorial and did everything like in the video so i guess something in my code is wrong??

thank you
 

DonManfred

Expert
Licensed User
Longtime User
unsupported class file version 52.0

Update Java to be Java V8 and make sure to set it in Tools-Configure paths
 

sorex

Expert
Licensed User
Longtime User
just wondering...

is there a benefit to do this in eclipse instead of writing it in B4A ?
 

ilan

Expert
Licensed User
Longtime User
error is still there.

B4A version: 7.01
Parsing code. (0.00s)
Compiling code. (0.02s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.02s)
Compiling debugger engine code. (0.44s)
Compiling generated Java code. (0.57s)
Convert byte code - optimized dex. Error
PARSE ERROR:
unsupported class file version 52.0
...while parsing sagital/net/geo/geometry.class
1 error; aborting
 

sorex

Expert
Licensed User
Longtime User
I was just wondering if it would be a speed increase if it was done straight in java. no reason to feel stepped on the toes, ilan.
 

ilan

Expert
Licensed User
Longtime User

Attachments

  • geometry_source.zip
    4.4 KB · Views: 337
  • geometry_lib.zip
    2.3 KB · Views: 314

ilan

Expert
Licensed User
Longtime User
thanx for the effort @DonManfred :)

i have started to learn Native coding (Java - AndroidStudio + Eclipse && Swift - Xcode)
i find it very interesting. i have already build my first Android App in Android Studio Yesterday (in Java)

i know how to create classes that returns objects and use methods and simple stuff like for(){} loops and do while, if statements and Switch.
how to convert variables and use them so real basics. the main thing here is to learn the syntax.

do you have maybe simple-medium eclipse source codes that you are willing to share?
the best way for me to learn is to see a full code (that works :) )

thank you
 
Top