Home > Back-end > After solving the Java file package picture error problem
After solving the Java file package picture error problem
Time:10-13
Good bosses, complete Java a little game, today in the eclipse run is good, but after the JAR file method is used to derive the, can't run,
I learned that is image path problem, should be a relative path, the final changes are as follows: Image1=ImageIO. Read (enclosing getClass (). The getResource ("/image/1. Dinosaurs PNG ")); Image2=ImageIO. Read (enclosing getClass (). The getResource ("/image/2. Dinosaurs PNG ")); Image3=ImageIO. Read (enclosing getClass (). The getResource ("/image/dinosaurs 3. PNG "));
But after the JAR file mode is used to derive the error in the CMD is as follows: D: \ & gt; Java jar - D: \ Java \ Di jar The Exception in the thread "main" Java. Lang. IllegalArgumentException: input==null! The at javax.mail. Imageio. Imageio. Read (imageio. Java: 1388) The at bag. Dinosaur. & lt; init> (Dinosaur. Java: 28) The at bag. GamePane. & lt; init> (GamePane. Java: 37) The at bag. The MainFrame. & lt; init> (MainFrame. Java: 12) The at bag. The MainFrame. The main (20) MainFrame. Java:
My picture is in the SRC/image inside, inside the SRC/bag is my class about Ask bosses to tell me, thank you