在我的Java servlet项目中,我使用了ajax,在那里使用了gson jar文件。在kali linux中没有IDE Eclipse作为操作系统。
我已经将gson.jar
放在WEB/lib/*中,并用javac -d ... -cp so the classpath is correct and when i use the same program in Eclipse it works well (here i entered the servlet-api.jar and WEB/lib/* to include all files)
编译了程序,但是我遇到了这个错误
src/com/Servlets/AjaxController.java:9: error: package com.google.gson does not exist
import com.google.gson.*;
^
请引导我解决这个问题,首先谢谢
最佳答案
首先,请确保您使用的Java版本> = 1.6,因为从该版本开始,正在考虑使用通配符(*)。
其次,您的类路径中的路径必须由:分隔,而不是; (在Windows中)
第三,确保在每个路径字符串的末尾都使用了通配符。
关于java - java类和 “import com.google.gson.*”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64699533/