My main code has two class and main has two references
LookupService citylookup = new LookupService("D://GeoLiteCity.dat"...
FileReader fr =new FileReader("d:\\IP.txt");
I export them into an executable jar file and I get D://testIP.jar
and D://testIP_lib/reference libraries...jar
I run java -jar testIP.jar
and it works.
However, I revise my reference to linux machine path ex: /home/admin/GeoLiteCity.dat
and /home/admin/IP.txt
and move textIP.jar
and testIP_lib
and GeoLiteCity.dat IP.txt
to /home/admin/
I run java -jar testIP.jar
again I get error
Exception in thread "main" java.lang.NoClassDefFoundError: com/maxmind/geoip/LookupService
at testIP.CountryLookupTest.main(CountryLookupTest.java:18)
I check they are java 1.7..version I don't know where I should set up ? Thank you.
Sounds like a classpath difference between the two environments. Check the CLASSPATH
environment variable in both environments, and check the Class-Path
entry in the MANIFEST.MF
file in the jar. I suspect that Eclipse built the jar with a Windows-based Class-Path
entry in the Manifest file inside the jar.
If this is of any help.
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/classpath.html
You would have to look how to use class path in the Linux environment.
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.