Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading jquery library to project Error:java: Illegal char <:> at index 4: http:\api.jquery.com

I use Intellij Idea. I want to download jquery library to have access offline to it in Intellij Idea in my Spring Project. So I typed "Alt + enter" on the link

 <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>

and chose "Download library". The library has dowloaded, and the problem is that after it I can't run my program, because all the time I see Error:java: Illegal char <:> at index 4: http:\api.jquery.com without any path. I have't even have something like written in my whole project.

When I had just global link to "https://code.jquery.com/jquery-1.12.4.min.js" and had internet access all worked properly.

I tried to download library in local file and put in header link to it actually after deleting library from intellij. But still don't working.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
</head>
<body>

    <input type="number" id="myInput" name="myInput" onchange="countOfTryings(this)">

    <a name="toChallenge" href="http://some_web_site.com?parameter1=4">This is link</a>
    <a name="toChallenge" href="http://some_web_site_other.com?parameter1=4">This is link 2</a>

    <script>
        function countOfTryings(variable) {
            $('a[name="toChallenge"]').each(function () {
                var oldUrl = $(this).attr("href"); // Get current url
                var str = oldUrl.substring(0, oldUrl.indexOf("parameter1"));
                var newUrl = oldUrl.replace(oldUrl, str + "parameter1=" + variable.value); // Create new url
                $(this).attr("href", newUrl); // Set herf value
            });
        }
    </script>
</body>
</html>

I want my program to change the urls of hyperlinks with name="toChallenge". To change the value of the request parameter "parameter1" to new value, what will be in input with id="myInput".

like image 287
Jan Avatar asked Aug 18 '19 15:08

Jan


2 Answers

After submiting a report to Intellij Idea I got an answer, that JS libraries are added to the Java classpath which is a bug, and to fix thit problem I need to do next: Project settings (ctrl+alt+shift+s by default) -> Modules -> in "Modules" select "Dependencies" -> find jquery dependency -> delete jquery dependency -> click "apply"

like image 108
Jan Avatar answered Oct 21 '22 07:10

Jan


I had same problem but deleting dependency did not help. I had to go to global libraries and delete jquery library as well.

like image 27
Odeta Avatar answered Oct 21 '22 05:10

Odeta