go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  index.html
 
Subject: index.html
Author: Alex_Raj
In response to: HelloWorld.java --> HelloWorld.js
Posted on: 04/01/2021 01:08:06 AM

Here is the corresponding HTML file index.html:

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>Hello world</title>
</head>

<body>
    <div id="target"></div>
    <script src="./js/org/zsp/jsweet/HelloWorld.js"></script>
</body>

</html>


 

> On 04/01/2021 01:04:02 AM Alex_Raj wrote:

Now, you can code a java file:
package org.zsp.jsweet;

import static jsweet.dom.Globals.*;
import jsweet.dom.HTMLElement;

public class HelloWorld {
	public static void main(String[] args) {
		alert("This example writes 'Hello world' in the document!");
		HTMLElement e = document.getElementById("target");
		e.innerHTML = "Hello world!";
	}
}


If everything goes smoothly, you should find a JWseet generated JS file here:
/js/org/zsp/jsweet/HelloWorld.js


Note: js is the default folder which can be configured via Window > Preferences > JSweet > Generated javascript folder





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.