Properly Putting Data Into a .jar for the Major Platforms
March 28, 2010 5:13 PM Subscribe
NetbeansFilter: I need to know exactly how to do a very simple thing - package a .jar file correctly so that the Java App inside can read critical data files, across the three major platforms.
posted by JoeXIII007 to Computers & Internet (4 answers total) 1 user marked this as a favorite
I have this app I am making with NetBeans. It generates drop down 'choice' menus such that it first reads the menu items from simple text and .csv files and then adds those items to the menus. The text and .csv files are to ensure that customization of the menus is easy when I pass this on, as this hopefully will have long term use.
Googling for solutions has led to me using the InputStreamReader with a Scanner, yet no complete solution. I have also previously used a File input and Scanner combo on Windows 7, packaged the .jar, and put the data files in the folder with the .jar file to no problem whatsoever.
The problem occurs when trying to cross platforms into Linux or Mac.
Thus the question, how to package the .jar file correctly so that across Windows, Linux, and Mac, the app reads the files correctly and thus works.
Many thanks! Recommendations of better alternative methods of achieving this (easily customizable file/source with list -> menu) are welcome.