creating a property file builder with eclipse?

Discussion in 'Java' started by Elhanan, Dec 16, 2005.

  1. Elhanan

    Elhanan Guest

    hi..

    i would to like to have eclipse perform a batch file each time i save
    my eclipse property file, the batch will run native2ascii program
    turning my hebrew into \u codes and place it in the web-inf /classes
    directory.

    can i do that?
    Elhanan, Dec 16, 2005
    #1
    1. Advertising

  2. Yes you can.

    You could use the ANT 'native2ascii' task to be executed automatically
    with Eclipse.
    The following are simple steps to follow with Eclipse 3.1 and a JDK
    (1.4+) already installed.

    1- Start Eclipse 3.1 with a JDK (not a JRE).
    To be sure, just before starting Eclipse, edit 'eclipse.ini' file in
    {ECLIPSE_HOME} folder
    and put in the two first lines the two following lines:

    -vm
    {JDK_HOME}\bin\javaw.exe

    This example works for Windows.
    Of course {JDK_HOME} must be change appropriately for the JDK root
    folder path.

    2- In yur project, make sure that all your property files :
    a- are located in 'hebrew_properties' sub-folder
    b- have the '.properties' file extension
    c- are saved with the appropriate encoding (for instance
    'ISO-8859-8' encoding).
    To be sure, open each file, then 'File' / 'Properties', then
    check with the 'text file encoding' section.

    3- In the root of your project, create a new file that you could name:
    'convert_properties.xml'
    and with the following content:

    <project name="convert_properties" default="convert">
    <target name="convert">
    <native2ascii encoding="ISO-8859-8"
    src="hebrew_properties"
    dest="WEB-INF/classes"
    includes="**/*.properties"
    />
    </target>
    </project>

    4- Right-click on your project, then 'Properties', select 'Builders' in
    tne left, then 'New' and 'OK' ('Ant Build' is pre-selected).
    Change the 'Name' field for 'convert_properties', then for
    'Buildfile' click on 'Browse Workspace...' and select the
    'convert_properties.xml' file.
    Then click on the 'Targets' panel, in 'Auto Build:' section click on
    'Set Targets...' and then 'OK' ('convert' is pre-selected).
    Then click 'OK' and again 'OK'.

    This should work fine and smoothly.
    Of course you can change the folder names / files extensions / other
    names at will.

    Regards
    Jean-Francois Briere, Dec 16, 2005
    #2
    1. Advertising

  3. Elhanan

    Elhanan Guest

    thanks, i created a build.xml and wrote
    <project name="properyConvert" default="convert">
    <target name="convert">
    <native2ascii encoding="ISO-8859-8"
    includes="*.properties"
    src="props"
    dest="WEB-INF/classes">
    </native2ascii>
    </target>
    </project>

    at first i tried placing in the src direcoty but then i saw that
    eclipse overwrote it by simply copying the original file, so i had to
    set in a different directory (anyway to supress it? ).
    Elhanan, Dec 17, 2005
    #3
  4. If it works, why changing it?
    Jean-Francois Briere, Dec 17, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    10,732
  2. John Goche
    Replies:
    2
    Views:
    11,143
    Darryl L. Pierce
    Jan 22, 2006
  3. Ulf Meinhardt
    Replies:
    0
    Views:
    2,833
    Ulf Meinhardt
    May 19, 2006
  4. www
    Replies:
    2
    Views:
    3,185
    David Segall
    Mar 9, 2007
  5. Phlip
    Replies:
    5
    Views:
    545
    Stefan Behnel
    Jan 13, 2010
Loading...

Share This Page