桌面快捷方式创建:onClick图像链接

时间:2015-12-02 09:00:58

标签: java

我使用的是JNI库(jshortcut-0.4-oberzalek https://ia600404.us.archive.org/1/items/popeye_patriotic_popeye/popeye_patriotic_popeye_512kb.mp4)。

我写了一个jsp文件并导入了这个jar,我在ajax调用中调用了这个jsp。 我放置了库项目文件夹,我使用的是WinSCP和putty。

现在我收到了java.lang.unsatisfiedlinkerror:java.library.path中找不到jshortcut

Code :DesktopCreation.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

 <%@ page import ="net.jimmc.jshortcut.JShellLink" %> 

 <%@ page import="javax.servlet.http.HttpServlet,javax.servlet.http.HttpServletRequest,
                javax.servlet.http.HttpServletResponse" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Insert title here</title>
    </head>
    <body>
    <jsp:useBean id="link" class="net.jimmc.jshortcut.JShellLink"></jsp:useBean>

        <%! 
            JShellLink link;

            String imgPath;
            String iconPath=""; 
        %>  

        <%
        link = new JShellLink();

            imgPath = JShellLink.getDirectory("") + "http://www.google.com";
            iconPath="F:/WorkWorship/ShortCut/img/ico6.ico";



            link.setFolder(JShellLink.getDirectory("desktop"));

            link.setName("Manju");

            link.setPath(imgPath);
            link.setIconLocation(iconPath);

            link.save();

        %>
    </body>
</html>



Code : Ajax
/*
 * creates a new XMLHttpRequest object which is the backbone of AJAX,
 * or returns false if the browser doesn't support it
 */
function getXMLHttpRequest() {
    var xmlHttpReq = false;
    // to create XMLHttpRequest object in non-Microsoft browsers
    if (window.XMLHttpRequest) {
        xmlHttpReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
            // to create XMLHttpRequest object in later versions
            // of Internet Explorer
            xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (exp1) {
            try {
                // to create XMLHttpRequest object in older versions
                // of Internet Explorer
                xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (exp2) {
                xmlHttpReq = false;
            }
        }
    }
    return xmlHttpReq;
}
/*
 * AJAX call starts with this function
 */
function createShortCut() {
    var xmlHttpRequest = getXMLHttpRequest();
    var con=confirm("Do you Wish to Crete?");
        if(con){
        xmlHttpRequest.onreadystatechange = getReadyStateHandler(xmlHttpRequest);

        xmlHttpRequest.open("GET", "DesktopCreation.jsp", true);
        xmlHttpRequest.setRequestHeader("Content-Type",
        "application/x-www-form-urlencoded");
        xmlHttpRequest.send(null);
        alert("ShortCut Created....");
        alert("Thanks for Downloading ShortCut");
    }else{
        alert("No thanks .....");
    }

}

/*
 * Returns a function that waits for the state change in XMLHttpRequest
 */
function getReadyStateHandler(xmlHttpRequest) {

    // an anonymous function returned
    // it listens to the XMLHttpRequest instance
    return function() {
        if (xmlHttpRequest.readyState == 4) {
            if (xmlHttpRequest.status == 200) {

                document.getElementById("hello").innerHTML = xmlHttpRequest.responseText;

            } else {
                alert("HTTP error " + xmlHttpRequest.status + ": " + xmlHttpRequest.statusText);
            }
        }
    };
}

Code:Shortcut.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>SHORTCUT</title>
        <script type="text/javascript" language="javascript" src="ajax.js"></script>    


    </head>


    <body>

        <h4 id="hello">Create ShortCut</h4>
        <input type="image" src="F:\WorkWorship\DescktopShortCut\Dasara.jpg" width="100" height="100" onclick="createShortCut()" />




    </body>
</html>

请任何人都可以帮忙。

感谢Advace

0 个答案:

没有答案