File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes How to create stand alone java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to create stand alone java application" Watch "How to create stand alone java application" New topic

How to create stand alone java application

Don Martino

Joined: Oct 04, 2008
Posts: 25
I have always coded web applications using jsp's and depending what is selected from the web page then methods in java classes are called and processed, but always returning to the jsp.
Now, I want to write a java program that simply reads a table, selecting off certain records, using data from these records to populate fields in output records and write the formatted output records to a flat file.
After all records are processed I need to hand off the flat file using NDM which will transmit the file to a server where another application will process these records.

A cron job will automatically run daily which will kick off my process. Will this cron job execute my stand alone java program containing a main method?

My processing consists of reading one record from table, performing a few calculations using data from record, populating the output record and writing this record to a flat file.

Should I include the connection and table processing in this same class or call a method in a separate class that performs the table stuff?
Don Martino

Joined: Oct 04, 2008
Posts: 25
Let me simplify my question;

I want to read records from a table, format and write new records to output flat file.

Do I simply write one java class that does it all or do I write another java class that performs the database processing?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
Probably better to have a class which handles the transmission to the database and back, and other classes which handle input and output.
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
If I would do it, I would separate the classes to talk to the db, to process the data and to talk to the files.


Experience and talent are independent of age
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 100
Its better to divide your operation into steps communicating to database,format it as your required format and send back to the server. Now in simple way you can create a class for each steps and make them to communicate with each other by passing the required data.

If you want to automate your process you can go for scheduler and timertask in java .

All search starts with beginner's luck and all search ends with victor's severly tested.
I agree. Here's the link:
subject: How to create stand alone java application
It's not a secret anymore!