i'm using ubuntu 11.04 , netbeans 7.0. i'm puzzled this. i've created test application reproduce ...
package test;
import timeutils.*;
public class test {
public static void main(string[] args) {
system.out.println(timeutils.millistoutcdatetimest ring(0));
}
}
timeutils static class of mine in separate netbeans project ...
package timeutils;
import org.joda.time.datetimezone;
import org.joda.time.datetime;
import org.joda.time.format.*;
public abstract class timeutils {
public static string millistoutcdatetimestring(long millis) {
datetimeformatter fmt = datetimeformat.forpattern("yyyy-mm-dd-hh-mm-ss.sss");
datetimezone zoneutc = datetimezone.utc;
datetime dtutc = new datetime(millis, zoneutc);
return fmt.print(dtutc);
}
... few other static methods
when use under netbeans it's fine , prints
1970-01-01-00-00-00.000
joda time jar in both jre/lib , jdk/lib/ext, , timeutils specified library in test project import works.
when run under terminal java -jar test.jar error
exception in thread "main" java.lang.noclassdeffounderror: org/joda/time/readableinstant
@ test.test.main(test.java:20)
caused by: java.lang.classnotfoundexception: org.joda.time.readableinstant
@ java.net.urlclassloader$1.run(urlclassloader.java: 217)
etc etc
have tried can think of cannot fix this. have specified joda time jar explicitly using java -cp <joda.jar> without effect.
not have classpath environment variable. i've tried without success.
please help! it's silly newbie error ...
well, that's disappointing response.
after bit of digging around found:
1. when specify 'java -jar' ignores classpath. specified in java documentation http://java.sun.com/j2se/1.4.2/docs/...inux/java.html not clear 'help' typing 'java'.
2. means jar must contain classes requires. netbeans include joda jar, select project , add joda jar using properties / categories - libraries / compile tab - add jar / folder.
again.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] java class not found - joda time
Ubuntu
Comments
Post a Comment