Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

javac -J?

Thread view: 
Mark Modrall - 14 Sep 2006 11:16 GMT
Hi...

I was just wondering if it was possible to use javac -J-Dname=value to
get compile-time constants into code, perhaps with annotations or
something?

For example, I'm trying to get something like

public class foo
{
  public static String compiledBy=@builder;
...
}

or the like - getting a compile-time constant to be a referencable
quantity in .class.

Or is runtime preference or properties the only way to do it?

Thanks
-Mark
Arne Vajhøj - 14 Sep 2006 23:50 GMT
> I was just wondering if it was possible to use javac -J-Dname=value to
> get compile-time constants into code, perhaps with annotations or
[quoted text clipped - 12 lines]
>
> Or is runtime preference or properties the only way to do it?

Java does not do preprocessing. Period.

You can use code or you can use configuration.

Maybe (just maybe) you could use some AOP (like AspectJ)
to insert the code you want.

Arne
Daniel Dyer - 15 Sep 2006 00:34 GMT
>> I was just wondering if it was possible to use javac -J-Dname=value to  
>> get compile-time constants into code, perhaps with annotations or  
[quoted text clipped - 10 lines]
>
> Java does not do preprocessing. Period.

The JDK tools don't, but that doesn't mean you can't do it.  Any number of  
general-purpose text processing tools or 3rd-party Java pre-processors  
could be used.  You could even do it with core Ant tasks.

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Arne Vajhøj - 15 Sep 2006 02:58 GMT
>> Java does not do preprocessing. Period.
>
> The JDK tools don't, but that doesn't mean you can't do it.  Any number
> of general-purpose text processing tools or 3rd-party Java
> pre-processors could be used.  You could even do it with core Ant tasks.

True.

But that has very little to do with Java.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.