-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2_02, 1.2.2
-
generic
-
generic
Bug 4074456 was reported as fixed, but it's not clear that
the evaluation was appropriate. Furthermore, I am still
able to reproduce the problem.
Following the guideline of the Java Tutorial:
http://java.sun.com/docs/books/tutorial/jar/basics/run.html
It seems that the API allows a mechanism for applets to access
images and sounds from a jar file. This mechanism doesn't
seem to appear to work for applications. Specifically,
put class files and gif files into a jar, test.jar
The following application will not find the specified gif file
from the jar. Run using: java -jar test.jar
import javax.swing.*;
import java.awt.*;
class GifTest extends JFrame
{
public static void main(String s[])
{
GifTest gt = new GifTest();
gt.show();
}
//constructor
public GifTest()
{
Dimension sDim = Toolkit.getDefaultToolkit().getScreenSize();
int frameW = sDim.width/2;
int frameH = sDim.height/2;
setBounds((sDim.width-frameW)/2,(sDim.height-frameH)/2,frameW,frameH);
JButton saveButton = new JButton("save");
saveButton.setIcon(new ImageIcon("images/" + "save.gif"));
getContentPane().add(saveButton);
}
}
The workaround shows what is necessary to get this to work.
If this is the intended behavior (you can't bundle your application
and images in a jar), then the documentation should be changed to
reflect this. For starters, the java tutorial.
See attached workspace.
mark.chamness@Eng 1999-07-02
the evaluation was appropriate. Furthermore, I am still
able to reproduce the problem.
Following the guideline of the Java Tutorial:
http://java.sun.com/docs/books/tutorial/jar/basics/run.html
It seems that the API allows a mechanism for applets to access
images and sounds from a jar file. This mechanism doesn't
seem to appear to work for applications. Specifically,
put class files and gif files into a jar, test.jar
The following application will not find the specified gif file
from the jar. Run using: java -jar test.jar
import javax.swing.*;
import java.awt.*;
class GifTest extends JFrame
{
public static void main(String s[])
{
GifTest gt = new GifTest();
gt.show();
}
//constructor
public GifTest()
{
Dimension sDim = Toolkit.getDefaultToolkit().getScreenSize();
int frameW = sDim.width/2;
int frameH = sDim.height/2;
setBounds((sDim.width-frameW)/2,(sDim.height-frameH)/2,frameW,frameH);
JButton saveButton = new JButton("save");
saveButton.setIcon(new ImageIcon("images/" + "save.gif"));
getContentPane().add(saveButton);
}
}
The workaround shows what is necessary to get this to work.
If this is the intended behavior (you can't bundle your application
and images in a jar), then the documentation should be changed to
reflect this. For starters, the java tutorial.
See attached workspace.
mark.chamness@Eng 1999-07-02
- duplicates
-
JDK-4247860 acrobat.jar needs to be exploded glyphs aren't coming in from jar file???
-
- Closed
-