JodaTime -v- Java Calendar API

edited May 2016 in Library Questions

I want a decent way of working with dates for a small project I'm working on.

On StackOverflow the answer seems to be 'use JodaTime' but it looks like it's difficult to get working with Processing - certainly I can't get it to show up as an available library (see below).

Additionally the Calendar API seems to have caught up with JodaTime in Java 8 but embarassingly I can't even find which version of Java Processing runs on!

So my questions are:

  • does Processing use Java 8?
  • if not, any ideas for getting JodaTime to work?

I've tried it in the following folders:

- Sketchbook > libraries > jodatime > jodatime.jar - Sketchbook > libraries > jodatime > library > jodatime.jar - Sketchbook > libraries > joda-time-2.4 > joda-time-2.4.jar - Sketchbook > libraries >joda-time-2.4 > library > joda-time-2.4.jar

Edit: I'm an idiot and was using the wrong path for my Sketchbook, so the only question remaining is: does processing use Java 8?

Tagged:

Answers

  • edited July 2014

    I am using Processing 2.2.1

    OK, I downloaded joda-time-2.4.jar and renamed it jodatime.jar then put it in the sketchbook folder

    .../Processing/jodatime/library/jodatime.jar

    I then restarted Processing and selected Sketch | Import Library | jodatime and it added the imports i.e.

    import org.joda.time.format.*;
    import org.joda.time.convert.*;
    import org.joda.time.*;
    import org.joda.time.tz.*;
    import org.joda.time.chrono.*;
    import org.joda.time.base.*;
    import org.joda.time.field.*;
    
  • println( javaVersionName );
    println( System.getProperty("java.home")  + "\n" );
    
    println( System.getProperty("os.arch") );
    println( System.getProperty("os.name") );
    println( System.getProperty("os.version") + "\n" );
    
    println( System.getProperty("user.home") );
    println( System.getProperty("user.dir")   + "\n" );
    
    println( sketchPath );
    println( dataPath("") );
    
    exit();
    
  • edited July 2014 Answer ✓

    If we wanna use the system's installed Java, we gotta get rid of Processing's "/java" subfolder.
    That works well on Linux. However for the Windows launcher, it demands that subfolder to exist!
    Therefore we gotta trick it by replacing that bundled subfolder by a hardlink junction targeting the OS's Java!

  • Thanks for the quick replies! See my edit above - I had the wrong sketchbook path set in Processing :( sorry for wasting your time!

    If we wanna use the system's installed Java, we gotta get rid of Processing's "/java" subfolder. That works well on Linux. However for the Windows launcher, it demands that subfolder to exist! Therefore we gotta trick it by replacing that bundled subfolder by a hardlink junction targeting the OS's Java!

    Thanks, I'll try that! Is there any downside to using Java 8 w/Processing?

  • edited July 2014

    Is there any downside to using Java 8 w/ Processing?

    I'm still using Java 7. Main downside is that Processing's pre-processor isn't full compatible w/ Java 5 yet!!!

  • Apart from getting jodatime to work (which is not hard). jodatime is a blessing!

Sign In or Register to comment.