The above code packages the class file (ReadingAccessDB.class) in jdbc folder. now when I run this file, I usually move the "carpets.mdb" file one level above the jdbc folder. for example if the class file is in C:\jdbc\ReadingAccessDB.class, I put the "carpets.mdb" in C:\
When running the class file I use "java jdbc.ReadingAccessDB" and it runs fine. My problem is now how can archive this application with its database file and make it executable so that when wherever I move the JAR file it should run.
Are you asking how to open and manipulate the Access DB file if it is packaged inside the JAR file? If so, I don't think it is possible to access it directly. A potential work-around is to write code that extracts the DB file from the JAR and then use it from the regular file system. You could then put it back into the JAR when you are done with it. This seems like more trouble than it is worth, in my opinion. But I guess that's up to you to decide.