Thursday, August 5, 2010

Creating an executable jar with dependent jars.

The following is skill you would require for packaging of a deliverable

  1. Set Java path like
          C:\setjdk16.bat
   2. Copy this java class into temporary dir
          cp Test.java C:\tmp\
   3. Switch to tmp directory
          cd C:\tmp
   4. Copy dependent jars dep1.jar dep2.jar C:\tmp
   5. Compile Java class
          javac -cp ./dep1.jar;./dep2.jar Test.java
   6. Create manifest.mft text file with contents like

Manifest-Version: 1.0
Main-Class: Test
Class-path: dep1.jar dep2.jar


   7. Archive contents
          jar cvfm myexe.jar manifest.mft *.class *.jar
   8. Run output jar like
          java -jar myexe.jar


To run with arguments
java -D -jar myexe.jar args[0] ...

Many a times even simple tend to forget this helpful concept

Note as on 17 OCT 2013 when using 1.7 JDK manifest.mft should look like else classloading of dependent jars fails  ( attribute Created-By mandatory )

Manifest-Version: 1.0
Main-Class: SSHCommandExecutorv2
Class-path: jsch-0.1.44.jar
Created-By: 1.7.0_06 (Oracle Corporation)

Wednesday, August 4, 2010

Parameters for resource messages

Spent a lot of time thinking/recollecting to do this.
Here it goes



import java.util.ListResourceBundle;
/*
** Resource bundle test
*/
public class AppMessageBundle extends ListResourceBundle
{
 
    static final Object[][] m_contents =
    {
    // KEY                  , MESSAGE

    // Messages for the migration exception log
     {"HELLO"         , "Hello without parameter."
     }
    ,{"HELLO_ARG1"    , "Hello {0}."
     }
    ,{"HELLO_ARG2"    , "Hello {0} and {1}."
     }


    // Errors and Exceptions
   

    // Genric Messages
    // To add as and when requirements arise

    // Command line usage
    // To add if requirements arise.

   
  };


  public Object[][] getContents()
  {
    return (m_contents);
  }
}




import java.text.MessageFormat;
import java.util.*;

/*
** Test program to understand 
** passing arguments to construct
** resource messages of more meaning.
*/

public class AppMessageBundleTester
{
  private static final String RESOURCE_BUNDLE = "AppMessageBundle";
 
  public static void main ( String[] args )
  {
      String name1 = "Test string";
      int num = 734;
      printResourceMessage("HELLO");
      printResourceMessage("HELLO_ARG1",new Object[]{name1});
      printResourceMessage("HELLO_ARG2",new Object[]{name1,name1});
      printResourceMessage("HELLO_ARG2",new Object[]{name1,num});
     
     
  } 
   private static ResourceBundle s_resBund = ResourceBundle.getBundle(
                                              RESOURCE_BUNDLE, Locale.getDefault());
    public static ResourceBundle getResourceBundle()
  {
    return s_resBund;
  }

  
  static void printResourceMessage(String message, Object[] names)
  {
    println(MessageFormat.format(s_resBund.getString(message), names));
  }

  static void printResourceMessage(String message)
  {
    println(s_resBund.getString(message));
  }
    static void println(Object o)
  {
    System.out.println(o);
  }

   
   
} //  end of class
This is all java and you need not have to go through hassle of having properties file. Specially useful in a web application.

Sunday, July 11, 2010

Career skill management over a period of time

The following is the block diagram ,summarizes my visualization till date.


The periphery is where your vision broadens and you become flexible and versatile.

Diagram should be self explanatory.

Tuesday, June 29, 2010

Use of Open source technologies

Its important that one does not get stuck with a particular development IDE. It so happened that I used Oracle JDeveloper for quite a long time and when I move out of Oracle workplace I thought learning a different IDE like Eclipse would take be time.

In fact it was not the case. Was able to quickly do some stuff like

1- Hooking up an external tomcat server to simulate the concept of embedded weblogic server concept in Oracle JDeveloper IDE
2- Running a JDBC program using MySQL DB on Windows against OOTB support for Oracle DB offered in Oracle Jdeveloper.

The gain here is you get to know the world outside Oracle products. And off course free from all licensing issues.

You get to know the new jargon and provided your fundamentals are right it is always easier to map your skills and not be tied with offerings of any particular vendor.

Two quotes I like to remember :
[1]
" When doing all this configuration against different products ensure you make note of the version numbers , their compatibility etc " This will help get better trouble shoot results when you get onto public forums.
- Thanks to Srinivas N Kini ( HOD and teacher during my undergraduate days )

[2]
"Oracle JDeveloper is a great IDE if you are integrating with Oracle technologies."
- Frank Niphimus ,Grant Ronald ( PM of Oracle Forms )

Have good documentation of steps that you perform and have patience to get things in place. Avoid getting reluctant to try new things. Do-not hesitate to experiment.

Tuesday, December 8, 2009

Four key PDF files to generate towards EOY and start afresh

Here the list of Four keys files that would have grown in the year and you like them to mark off towards the end of year.
1) Status Report
2) Work tips
3) Bookmarks All(IE+FF)
4) lifein200X

It is intended to have a PDF generated from text/HTML format of editing.

Been doing this for all the years in corporate industry experience, and nice to keep this going. Apart from this, a printed report updated Expenses report and Assets tracker excel file would also be a handy reference.

Enjoy organizing rather than relying on Google's tools to realize the pain for gain.

Tuesday, October 20, 2009

Digesting the ADF jargon - is it worth doing ?

Over the past 100 hours or so I have been trying to learn Oracle ADF framework offerings upon Fusion MiddleWare 11g.

FYI - Oracle ADF is something similar to .NET Framework that Microsoft develops.

Its been a trying experience. 2-Day presentation by Jeff Gallus covering around 440 pages of slides with two visual OBE sessions to develop RIA via ADF had all the bombardment required to go crazy.

Wonder if there is something missing or a gap created that people/framework development guys did OR is it a common feeling when one starts to learn a totally new technology all together.

Here goes the list of information amassed.
1. PDF's
2. Recording of presentation slides.
3. Project work spaces
4. Step by step instruction via a evernote .enx ( 2 )

Wonder , why people did not use the offerings of OS to achieve their tasks,( like why have a file browser component when OS provides it, Why do Pie charts from excel data ; when Excel itself offers some stuff to do the same; ) and went ahead creating their framework to get these running in a complex approach adding another layer. This not only demands hardware investment but also a learning curve.


Was it to illustrate and demo their knowledge on design patterns and their application. Only time can answer. For now you need to give yourself some time for the ADF jargon to sink and get back later learning more on J2EE and see more applications working on ADF.

Key take away points :

[1] The key to adding some would be to use some features in Jdeveloper which
eases your day to day work. ( i.e how technology impacts your daily life )

[2] The presentation slides ( keys ones ) would help in problem solving skills
better analyze data and flows.

[3] Voice recording help you into getting trained to make a speech and educate people.

Thursday, October 8, 2009

Is ANT an abuse of XML technology to sell dependency

In this world of technology you have multiple ways to achieve a task. Sometimes by just switching to new technology may be grief.

One such instance I feel is ANT build tool.
There is nothing that gmake cannot do that ant can.

The only core advantage with Ant would be its creation of custom tags for custom tasks.
However the dependency induced to use it
1) Check the well formed of XML file build.xml
2) Ensure it adheres to Ant syntax for simple tasks upon the first requirement
3) Do ensure you got JRE running on your platform.


Anyway, I would not shoe this approach for it makes me aware that people can devise complex approach to tackle a problem and make it an invention/technology as they call.

Also to keep track of the ANT evaluation here goes my first build.xml
Refer outside this area since since this blog provider doe snot display xml file :(


























Time to look at some good aspects
- Ant also throws some deprecation errors
- Amazing documentation available at Apache site http://ant.apache.org/

Followers