aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: can't open as .jar, accessed as .zip Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: can Watch "B&S: can New topic
Author

B&S: can't open as .jar, accessed as .zip

Grary Stimon
Ranch Hand

Joined: Sep 30, 2008
Posts: 42
I didn't have the JRE or JDK installed when I downloaded my SCJD B&S assignment. So, I opened the .jar exam file as a .zip. The appearance of the database file has since been vexing to me -- whether viewed in a text or hex editor. So, I'm thinking maybe the assignment must be opened as a .jar.

Mine may prove to be a minor worry, but I'm on guard not to work with any materials that do not match exactly what Sun sent.

Thanks for any comments,

Grary
Alex Belisle Turcot
Ranch Hand

Joined: Apr 26, 2005
Posts: 516
Originally posted by Grary Stimon:
I didn't have the JRE or JDK installed when I downloaded my SCJD B&S assignment. So, I opened the .jar exam file as a .zip. The appearance of the database file has since been vexing to me -- whether viewed in a text or hex editor. So, I'm thinking maybe the assignment must be opened as a .jar.

Mine may prove to be a minor worry, but I'm on guard not to work with any materials that do not match exactly what Sun sent.

Thanks for any comments,

Grary


In all cases, a jar file is a zip file. To open it and view what's inside, opening it just like a zip file is the only option.

About the database file, can you elaborate on the format ? What is unusual about it ?

If I open mine with notepad, I can see words separated by "square" and other special characters... It is meant to be read as bytes with some minor conversion..

Which filename are you refering to and what does it look like.

Regards,
Alex
[ October 03, 2008: Message edited by: Alex Belisle Turcot ]
Mahendran Mohan
Greenhorn

Joined: Jul 02, 2008
Posts: 11
Agree with previous rancher. Zip or Jar doesnt matter.

As for your concern on db file: You might have to look at your db schema definition. db file is not supposed to be processed by text editors. You might only see a mix of special and normal characters if you open it. It is supposed to be processed by application as per its schema definition.


Cheers, Mahendran<br />SCJP, SCWCD, SCJD-B&S in progress.
Mahendran Mohan
Greenhorn

Joined: Jul 02, 2008
Posts: 11
Agree with previous rancher. Zip or Jar doesnt matter.

As for your concern on db file: You might have to look at your db schema definition. db file is not supposed to be processed by text editors. You might only see a mix of special and normal characters if you open it. It is supposed to be processed by application as per its schema definition.
Jethro Borsje
Ranch Hand

Joined: Jul 22, 2008
Posts: 100
The db file is binary, it is not supposed to be opened in a text or hex editor. You should read it using a DataInputStream or RandomAccessFile using your Java program.


SCJP, SCJD
Grary Stimon
Ranch Hand

Joined: Sep 30, 2008
Posts: 42
Thank you for all your helpful comments.
Daniel Salomons
Greenhorn

Joined: Oct 07, 2004
Posts: 5
To understand the file format read the instructions.html VERY, VERY carefully. One thing that needs some explanation is the 'magic cookie' which is called at the English Wikipedia "magic number". It is a 4 byte integer, that signifies the file type. If on a Unix/Linux system the command: file <dbfile> is invoked, a message stating that it is a data file will appear. To me it seems that you'll make Sun a little bit happier if you check for the right number at the beginning of the file, and give a warning if it is not what is expected.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: can't open as .jar, accessed as .zip