|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
File Reading and Writing
I need to read and write to files found inside the executable jar sent to the cRIO. Does anyone know how I might do that? The java.io package available doesn't have any of the necessary classes or interfaces to do so, niether does the java.util package.
|
|
#2
|
||||
|
||||
|
Re: File Reading and Writing
Doing anything with files inside an executable jar isn't trivial. Just loading a library that's packaged within a jar file takes more code than one would think it should (via Class.getResourceAsStream)
What files are you try to write to exactly? |
|
#3
|
|||
|
|||
|
Re: File Reading and Writing
I can assume you are trying to do this: load configuration in static files bundled in the jar, then change configuration data later?
If my wild guess is correct, I would use the bundled files as defaults, and then copy them out of the jar into the flash FS. Then, when the jar loads it can check the FS and either A) load the default if an existing config doesn't exist, B) leave it alone, or C) selectively replace components based on some method you figure out. Your app can then load off the local config rather than the bundled one. iPhone apps often do things like this as bundled files are code signed and therefore non-writable. |
|
#4
|
||||
|
||||
|
Re: File Reading and Writing
You could also loosen the restriction that the file has to be in a jar.
You can use ftp to copy any file you want to the cRIO, then use "regular" Java ME file io (see http://www.chiefdelphi.com/forums/sh...d.php?t=85012). The SDK uses ftp itself to copy your jar file to the cRIO (actually a "suite" file, but similar contents). You can poke around the ant scripts (deploy.xml if I recall) to see how to script ftp copies. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|