How to invoke Lombok from javac

697 views
Skip to first unread message

Michael Lorton

unread,
Aug 27, 2009, 11:12:50 PM8/27/09
to project-lombok
I do this:
x.java:

@lombok.Data
class x { int z; }

$ javac -classpath lombok.jar x.java
$ javap x
Compiled from "x.java"
class x extends java.lang.Object{
    int z;
    x();
}

So I'm still missing something.

M.

Reinier Zwitserloot

unread,
Aug 27, 2009, 11:28:00 PM8/27/09
to Project Lombok
Are you using javac 1.6 and not javac 1.5?

Michael Lorton

unread,
Aug 27, 2009, 11:42:14 PM8/27/09
to project...@googlegroups.com
It's a Mac -- no 1.6.

$ java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)

M.

Reinier Zwitserloot

unread,
Aug 28, 2009, 12:01:53 AM8/28/09
to Project Lombok
Lombok only works on javac 1.6. 1.5 does not support the annotation
processing API (well, it kind of does, with specific command line
switches, but that API is very different, and javac went through a
complete rewrite in any case).

Mac does have javac 1.6 - had it for over a year now. Just run
software update. Possibly your system is not setup to use 1.6 by
default - mess around with the java setting app in /Applications/
utilities, or just run /System/Library/Frameworks/JavaVM.Framework/
Versions/1.6/Commands/javac

If you're on a pre-intel mac, or one of the very first without 64-bit
support, then apple's VM indeed is stuck at 1.5. you'll need to
download soylatte: http://landonf.bikemonkey.org/static/soylatte/ -
and use that javac. Lombok works fine with that.



On Aug 28, 5:42 am, Michael Lorton <mich...@circuspop.com> wrote:
> It's a Mac -- no 1.6.
>
> $ java -version
> java version "1.5.0_19"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
> Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)
>
> M.
>

Michael Lorton

unread,
Aug 28, 2009, 1:43:54 PM8/28/09
to project...@googlegroups.com
 :::
::::::::... :-|
 :::

(That's my head exploding.)

To summarize:
+ Use Java 1.6
+ Don't begin the file with a blank line

Not a lot for a day's work, but whatever.  (Maybe you can put something in the jar so it fails with better messages; e.g. "Use javac 1.6, dumbass!")

I'm curious why my (old, crusty, 32-bit-on-a-good-day) Mac can run 1.6 from Eclipse but apparently, not from the command line.  If I really need Maven to run on my Mac, I guess I'll get the latte thing.

M.
Reply all
Reply to author
Forward
0 new messages