簡體   English   中英

java類和“導入com.google.gson.*”錯誤

[英]java class and "import com.google.gson.*" error

在我的 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)編譯我的程序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,因為從這個版本開始,正在考慮通配符 (*)。

其次,類路徑中的路徑必須由 : 在 unix 系統中分隔,而不是 ; (這是在窗口中)

第三,確保在每個路徑字符串的末尾使用了通配符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM