java类和“import com.google.gson.*”错误
在我的JavaServlet项目中,我使用了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.*;
^
请引导我解决这个问题,首先谢谢
# 1 楼答案
首先确保您使用的是java版本>;=1.6原因自本版本起,通配符(*)正在考虑中
第二,类路径中的路径必须按以下方式分隔:在unix系统中,而不是;(在windows中)
第三,确保在每个路径字符串的末尾使用了通配符