Executing javascript in java - Opening a URL and getting links

后端 未结 5 1924
醉话见心
醉话见心 2020-12-19 18:57
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.io.FileReader;

public class Main {

    public static void main(String[] args         


        
5条回答
  •  囚心锁ツ
    2020-12-19 19:41

    In javascript window means browser window. So when you are trying to execute this js from Java, it is unable to find browser window and you are getting error. You can use URL class in Java to get the content of the url.

提交回复
热议问题