Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    crgardner
    @crgardner
    @vincenzo97_gitlab I ret
    @vincenzo97_gitlab I return an object from cheerpj and translate it to something i can use in javascript or an angular program.
    crgardner
    @crgardner
    @vincenzo97_gitlab I have also used the global js api that @alexp-sssup linked to above to call into my angular app. I was not updating the dom, but i did let java push information to my web app.
    vincenzo bovino
    @vincenzo97_gitlab
    I need to receive from the java program once I have finished an array with all the values. I need these values because I have to store them in the db. where can I see the code of how to do it?
    Alessandro Pignotti
    @alexp-sssup
    @vincenzo97_gitlab You have a Java array with your values right? You can simply define a function from the JS side (e.g. function valuesFromJava(a){}) and call that function using the cjCall API described in the page. Example Global.jsCall("valuesFromJava", javaArray)
    From the JS side you will see a JS array, just skip the first element (by convention)
    vincenzo bovino
    @vincenzo97_gitlab

    suppose I have an array with the results in the java code iterno. In java with this array it is only populated with values.
    if I understand correctly I should create a function within my web page of the type function valuesFromJava(a){}.

    then later in the java project call Global.jsCall("valuesFromJava", javaArray);
    the first parameter is the name of the function js, the second will be the array of values.
    So within the function javascript valuesFromJava(a) will it be possible to use the array?
    Did I do something wrong?

    Alessandro Pignotti
    @alexp-sssup
    What you wrote seems correct. Does something wrong happen?
    vincenzo bovino
    @vincenzo97_gitlab
    I only miss one thing. how do I use the Global.jsCall method? what class should I import? it is not imported directly from netbeans
    Alessandro Pignotti
    @alexp-sssup
    import com.leaningtech.client.Global;
    You need to add cheerpj-dom.jar to the classpath
    vincenzo bovino
    @vincenzo97_gitlab
    I have this script that allows me to read the file without having to make the input. now I want to pass it to the virtual file system. the variable s I do not know why it is not printed. then if I run
    cheerpjAddStringFile("/str/standard.TXT", standard); it gives me this error: Uncaught ReferenceError: cheerpjAddStringFile is not defined
    at XMLHttpRequest.req.onload
    is there another way to do what I want? I want to take the content of the file and create in the virtual file system a standard.txt file with that content.
    vincenzo bovino
    @vincenzo97_gitlab
    I managed to convert the text to Uint8Array but the following error remains.
    Why?
    error is :
            Uncaught ReferenceError: cheerpjAddStringFile is not defined
    at XMLHttpRequest.req.onload 
      var req = new XMLHttpRequest();
        req.onload = function(){
        //   var a =this.responseText;
          // document.getElementById("a").innerHTML= a;
    
          var enc = new TextEncoder();
            var s= enc.encode(this.responseText);
               document.getElementById("a").innerHTML= enc.encode(this.responseText);;
             cheerpjAddStringFile("/str/standard.TXT", s);
        };
        req.open('GET', './standard.TXT');
        req.send();
    Alessandro Pignotti
    @alexp-sssup
    @vincenzo97_gitlab This issue also happened to you before if I recall correctly. Very simply you need to make sure the code run after the cheerpjInit() promise completes.
    vincenzo bovino
    @vincenzo97_gitlab
    last question: if I had to bring everything online for example on "altervita" the functioning of the software is guaranteed?
    Alessandro Pignotti
    @alexp-sssup
    @vincenzo97_gitlab I am not fully understanding the question, could you try to rephrase that?
    vincenzo bovino
    @vincenzo97_gitlab
    I am currently working in local using xampp. When I pass my web page on "altervista" the virtual display opens correctly and the app will work?
    Alessandro Pignotti
    @alexp-sssup
    You need to take care of using the correct paths. The /app/ filesystem refers to the root of the domain. So for example if you deploy on https://aaa.somedomain.com/something/ your paths should be something like /app/something/name.jar
    vijay kumar
    @vijayvelaga
    How to open java applet gui application in chrome browser using cheerpj chrome extension?
    we use internet explorer to lunch applets.
    i have to convert my java applets to web UI can you help me on this?
    This morning i was tried to lunch my applets application in chrome browser with cheerpj extension but it won't lunch, any thing i have to configure instead of cheerpj extension?
    Alessandro Pignotti
    @alexp-sssup
    @vijayvelaga GUI Applets, both using AWT and Swing are supported. Is the site you want to use accessible from internet? In that case we can take a look at what the problem might be
    Otherwise we will need more information from you, at the very least the contents of the browser console (you can see that from the dev tools of Chrome)
    and a screenshot of the page
    yxo-in
    @yxo-in
    Hi I'm trying out CheerpJ on my intended .jar but it does not generate the .js codes?
    image.png
    Alessandro Pignotti
    @alexp-sssup
    Can you show us the output of unzip -l zxc_application.jar?
    yxo-in
    @yxo-in
    I'm afraid not as the contents of the application are confidential. Could it possibly be caused by encryption?
    Alessandro Pignotti
    @alexp-sssup
    What sort of encryption? CheerpJ does not require Java code signing
    If the output is empty that means that no .class file could be read
    from the jar file
    yxo-in
    @yxo-in
    so CheerpJ only reads the .class files in the jar file?
    Alessandro Pignotti
    @alexp-sssup
    Not necessarily, the CheerpJ runtime can also deal with standalone class files, but they are rarely used. When using the Ahead-Of-Time compiler (cheerpjfy.py, which you have used) CheerpJ looks for class files into JAR files.
    JAR files are just ZIP files that contain the class files
    Does the following command: unzip -l zxc_application.jar | grep .class
    show class files?
    yxo-in
    @yxo-in
    Thanks for the insights. I'm using 7-zip instead.
    Within the jar file is a .ear file consisting of the .class files
    Would Cheerpj be able to look through the .ear file to get the class files?
    Alessandro Pignotti
    @alexp-sssup
    Hmm... ear files are not supported by CheerpJ. They also seem to be a Java EE specific concept
    While CheerpJ supports Java SE.
    Can you explain a bit about the architecture of your application? Java EE applications usually have a server side component which is not (usually) a good fit for conversion using CheerpJ.
    What should be converted using CheerpJ is the client side of the application
    which may be an applet or a full Java application