You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have 3 simple java files in src/main/java/org/teavm/helper directory:
Main.java
package org.teavm.helper;
public class Main {
public static void main(String[] args) {
System.out.println("Hi From Client.java");
Parent parent = new Parent();
parent.showMessage(10);
Child child = new Child();
child.showMessage(10);
}
}
Parent.java
package org.teavm.helper;
public class Parent {
String name = "Parent";
void showMessage(int number) {
int doubled = number*2;
System.out.println("Parent Class doubles " + number + " to: " + doubled);
}
}
Child.java
package org.teavm.helper;
class Child extends Parent {
@Override
void showMessage(int number) {
int tripled = number*3;
System.out.println("Child Class triples " + number + " to: " + tripled);
}
}
Goal: I want to convert the Parent.java and Child.java Java classes to JavaScript using TeaVM without calling them from the Main.java. When I achieve this, I will be able to scale this to a larger project.
Is it possible to achieve this without invoking them directly in Main.java? If yes, how can I set up TeaVM to convert these classes to JavaScript successfully without an entry point in Main.java? Kindly help me to achieve this
Thank you in advance.
PS: I tried the below ways by referring the internet:
Import Annotation - org.teavm.interop.Import is actually used to use JS code into Java code.
Export Annotation - org.teavm.interop doesn't contain 'Export'
Static Block - Build was successful but the JS was not created
Preserve Annotation - org.teavm.interop doesn't contain 'Preserve'
JS Body Annotation - JS requires more manual code rewrite
Class Reflection - Only @ReflectClass annotation throws error
The text was updated successfully, but these errors were encountered:
I have 3 simple java files in src/main/java/org/teavm/helper directory:
Main.java
package org.teavm.helper;
public class Main {
public static void main(String[] args) {
System.out.println("Hi From Client.java");
}
Parent.java
package org.teavm.helper;
public class Parent {
String name = "Parent";
}
Child.java
package org.teavm.helper;
class Child extends Parent {
}
Goal: I want to convert the Parent.java and Child.java Java classes to JavaScript using TeaVM without calling them from the Main.java. When I achieve this, I will be able to scale this to a larger project.
Is it possible to achieve this without invoking them directly in Main.java? If yes, how can I set up TeaVM to convert these classes to JavaScript successfully without an entry point in Main.java? Kindly help me to achieve this
Thank you in advance.
PS: I tried the below ways by referring the internet:
Import Annotation - org.teavm.interop.Import is actually used to use JS code into Java code.
Export Annotation - org.teavm.interop doesn't contain 'Export'
Static Block - Build was successful but the JS was not created
Preserve Annotation - org.teavm.interop doesn't contain 'Preserve'
JS Body Annotation - JS requires more manual code rewrite
Class Reflection - Only @ReflectClass annotation throws error
The text was updated successfully, but these errors were encountered: