go to  ForumEasy.com   
JavaPro
Home » Archive » Message


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

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


 

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

If starting from a brand new project ...

Here is the procedure:
  • File > New > Dynamic Web Project -- Named as HelloJSweet
  • Right click on your project: Configure > Enable JSweet builder
  • Right click on your project: Configure > Convert to Maven Project. Leave all the default options.
  • Edit your pom.xml to add the JSweet repository and dependency sections

    <!-- repositories -->
      <repositories>
        <repository>
          <id>jsweet-central</id>
          <name>libs-release</name>
          <url>http://repository.jsweet.org/artifactory/libs-release-local</url>
        </repository>
        <repository>
          <snapshots />
          <id>jsweet-snapshots</id>
          <name>libs-snapshot</name>
          <url>http://repository.jsweet.org/artifactory/libs-snapshot-local</url>
        </repository>
      </repositories>
      <!-- end repositories -->  
    



    <!-- dependencies-->
    	<dependencies>
    		<dependency>
    			<groupId>org.jsweet</groupId>
    			<artifactId>jsweet-core</artifactId>
    			<version>6.3.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.jsweet.candies</groupId>
    			<artifactId>jquery</artifactId>
    			<version>1.10.0-20170726</version>
    		</dependency>
    	</dependencies>
    <!-- end dependencies-->
    






    References:
    • Next Post: index.html  Alex_Raj  04/01/2021 01:08:06 AM
    • Previous Post: pom.xml  Alex_Raj  04/01/2021 01:02:04 AM
    • Next Topic: NPM Scripts  WebSpider  04/22/2021 09:55:59 PM
    • Previous Topic: WebSocket  WebSpider  07/11/2020 12:57:01 AM
    • Index: by Date
    • Index: by Topic


  •  


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