In my linux, I have my java files that I coped from my windows eclipse project, and now I want to compile it in linux.
The folder structure is
PlutoMake.java
java-json.jar
Filter\ColorFilter.java
Filter\Darken.java
Filter\NoFilter.java
Filter\VividLight.java
The PlutoMake file has these imports and some others too like for json
import Filter.ColorFilter;
import Filter.Darken;
import Filter.NoFilter;
import Filter.VividLight;
But when I try to compile plutomake, it says
PlutoMake.java:12: package Filter does not exist
import Filter.ColorFilter;
I already use this to compile it:
javac -cp "java-json.jar" PlutoMake.java
and similarly for other ones too.
Does anyone know how to import it?
Thanks
You are getting package Filter does not exist
error because the Filter.*
classes are not present in the class path.
First compile the java files in side the folder Filter
then compile the PlutoMake.java
using javac -cp "java-json.jar;." PlutoMake.java
javac -cp "java-json.jar;." PlutoMake.java
I'll advice to use some build tool like Maven or Gradle or Ant
If i understand the question correctly. In eclipse just go to fil > Import > Existing Projects into Workspace Select your project and import all your files. Then hit finish. Are they in the right subdirectories?
If you put /usr/share/'classpath', files defined with package Filter should be in /usr/share/Classes/Filter/ try setting java -classpath
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.