The variable jarFile is a java.util.jar.JarFile object.
In 1.6, java.util.jar.JarFile *does not* have a getUrl method.
doesn't have a getContentLength () method. If it did it is reasonable to
assume that it would return the size of the jarFile.
effectively do nothing. I haven't studied your class, but I think it will
still work without the "jarFile.getUrl().getContentLength();" line.
Thank you all
honestly, I have no clue what it should be other othen than the method was
attempting to list content of a jar or zip file on a Jtable, I was just
trying to convert an old liberaary for use on jdk1.6
Looks like I will have to rewrite the methods with real plain jdk util.jar
class methods.. I think the old libray included some web library as well
here is part of the problematic original code
package com.something;
import javax.swing.*;
import javax.swing.table.*;
import java.io.*;
import java.util.*;
import java.util.jar.*;
static void listJar( JTable aJTable, String sJarFileSpec) {
JarFile jarFile = null;
java.util.jar.Manifest manifest = null;
int iEntries = 0;
// list jar content in a Jtable contructed with either the
jarTableModel, or the the jarColumnNames
try {
jarFile = new JarFile(sJarFileSpec);
iEntries = jarFile.size();
//jarFile.getUrl().getContentLength();
manifest = jarFile.getManifest();
if ( manifest != null ) {
//@@debug java.util.jar.JarEntry[] entries =
manifest.getEntries();
//entries
}
} catch( java.io.IOException i) {
if ( i.getClass() == FileNotFoundException.class )
System.out.println(i);
javax.swing.JOptionPane.showMessageDialog(null, "Invalid jarFile:
"+i);
if ( jarFile == null) return;
} finally {
if ( manifest != null ) {
manifest.clear();
manifest = null;
}
try {
if ( jarFile != null ) jarFile.close();
} catch (IOException e) {};
}
}
I don't know how it could have compiled under the old jdk, except
possibly it came with some compiled classes without source code. Now that
neteans got rid of the compiled classes from the library, it just does not
have the desired mehods
"Roedy Green" <see_website@mindprod.com.invalid> wrote in message
news:556s44tv99a9pvu17er82tv732dbqovbkd@4ax.com...
On Tue, 10 Jun 2008 01:55:33 GMT, "GS" <NOEmail@noJunk.net> wrote,
quoted or indirectly quoted someone who said :
what is the equivalent class of jarfile in jdk 1.6.x? In particular
jarfile.geturl()
I tried googlr , so far I have not found it yet
thanks for your time and help
to see the methods of JarFile see http://mindprod.com/jgloss/jar.html
I think you may have confused the JarFile class with the methods used
to grab resources, i.e. members inside the current jar
via an intermediate URL.
See http://mindprod.com/jgloss/resource.html
http://mindprod.com/jgloss/image.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com