Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid or corrupt jarfile

 
Derek Garson
Frequent Advisor

Invalid or corrupt jarfile

This is just to help anyone else who bumps into this.

I built a Java application into a jar file on Windows and it worked fine.

I FTPd it over to VMS and

java -jar xxx.jar

gives

Invalid or corrupt jarfile xxx.jar

Strangely

jar -tfv xxx.jar

is completely happy with the jar file, as is

unzip /list xxx.jar

I eventually realized that java -jar won't accept a jar file that has FIX 512 record format (which is what it got after the FTP).

This is a non-sensical inconsistency. Either java and jar should both reject the file or neither should reject the file (preferably the latter!).

Anyway

set file/attr=rfm=stmlf xxx.jar

fixes the problem.

To add to the inconsistency, doing the same exercise with a class file, java is quite happy i.e. java is quite happy to load a class file that has FIX 512 record format.
5 REPLIES 5
H.Becker
Honored Contributor

Re: Invalid or corrupt jarfile

This is known and very likely documented in any of the Java on VMS manuals. But it seems worth to repeat any time one mentions Java and VMS in one sentence: make sure all your files are in Stream_LF.

It may work for some other files - yeah you can use your favorite editor and create a java source - but you may see unexpected or no results. If javac detects a syntax error in your RFM:VAR source, it will not be able to point to the right spot.

$ javac x.java
x.java:5: unclosed string literal
^
x.java:6: ')' expected
^
2 errors

$ convert/fdl=stmlf x.java;1 x.java;2
$ javac x.java
x.java:5: unclosed string literal
System.out.println("Hello);
^
x.java:6: ')' expected
}
^
2 errors
$

I heard that someone copied a jpeg file with ftp/bin, which wasn't displayed by his Java application on VMS at all.

You probably want to create an archive on the source side (by zip, backup...) and resolve it at the target side. That worked for me.

I once suggest to VMS Java engineering to make T-shirts with the printings "Java on VMS" on the front and "Stream_LF" on the back. It still seems a good giveaway.
Steven Schweda
Honored Contributor

Re: Invalid or corrupt jarfile

> I FTPd it over to VMS [...]

Note that if you're pulling it over to VMS,
wget has a potentially useful option. From
the "-h" help:

[...]
FTP options:
--ftp-stmlf Use Stream_LF format for all binary FTP files.
[...]
Derek Garson
Frequent Advisor

Re: Invalid or corrupt jarfile

Digressing slightly,

http://www.gnu.org/software/wget/manual/wget.html

says

"a port to VMS is maintained by Steven Schweda, and is available at http://antinode.org/"

however that web site doesn't readily yield anything useful.

Is the link in the wget manual out of date or is that web site just unhelpful?
Derek Garson
Frequent Advisor

Re: Invalid or corrupt jarfile

I'm actually pushing, not pulling.

For my FTP server (MultiNet), the magic incantation seems to be to send the FTP site-specific command

SITE RMS STREAM ON

I couldn't see any way to make that the default on the server side.

I haven't found any way to send that with my FTP client (FileZilla) but, for example, in the Windows command line FTP client, you would use the "literal" command to send that site-specific command and it does work.
Highlighted
Steven Schweda
Honored Contributor

Re: Invalid or corrupt jarfile

> [...] available at http://antinode.org/"

It's antinode.info now (sad to say). Have
all the Web search engines gone out of
business, so that it's really difficult to
find?

> [...] in the Windows command line FTP
> client, you would use the "literal" command
> [...]

With some command-line FTP clients, the
"quote" command does the job of passing
commands to the server. I don't know about
FileZilla.