Go to Post p.s. note that 5-1/2 hours in the car with your daughter on the way to IRI is NOT the same as 10 hours in the van with seven members of Team 116 on the way to IRI. One is a wonderful familial experience, the other is an opportunity to go insane. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-05-2011, 02:31 AM
james7132
 
Posts: n/a
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 08-05-2011, 09:13 AM
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,610
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
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?
__________________

Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub
Reply With Quote
  #3   Spotlight this post!  
Unread 08-05-2011, 11:20 AM
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,182
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-06-2011, 10:38 AM
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 07:09 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi