• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My .PNG background will not export ||THIS HAS BEEN RESOLVED!!! THANKS!!||

 
Ryan Giomi
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The title says it all. I have written a calculator that runs fine in eclipse, in fact here is a screen showing what it looks like:


The problem is that when I export the code to a .jar the .jar will not run. It acts like a non gui export (ie you write console code, export it, and it will not run no matter how many times you dbl click it.)

Here is my code. Granted, this is not all of it, but this code WILL get the gui up and running, allow you to make selections in the comboboxes, etc. You just need to make a Main.


The code in bold, hopefully red too (I tried to make it red, wasnt sure of allowable formats) seems to cause the trouble. If I get rid of it, then it will export (without using the .png background) and will run fine as a .jar. Can anybody pt out why my graphical bground is not being included?

Thanks,

Ryan

[ January 24, 2007: Message edited by: Ryan Giomi ]

[ January 24, 2007: Message edited by: Ryan Giomi ]

[ January 24, 2007: Message edited by: Ryan Giomi ]

[ January 25, 2007: Message edited by: Ryan Giomi ]
[ January 25, 2007: Message edited by: Ryan Giomi ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Eclipse 3.2 and got your code to work with a .png of my own. I didn't see a "main()" method in GUI, so I added one to it that just creates a new GUI() instance to get it to run...

Steps taken:
1. Select both the "GUI" class and the "CalcBg.png" file in Eclipse. (Also include whatever class with your "main()" if your "GUI" class doesn't include "main()".)
2. Right click, "Export". Select "JAR File" and click "Next"
3. Check "Export generated class files and resources". Provide name for JAR file. Click "Next".
4. Check "Export class files with compile warnings" and "Export class files with compile errors" (Because there are compile warnings in the code...) Click "Next".
5. Select "Generate the manifest file". Click "Browse" next to the "Main Class" box and select the "GUI" class (or whatever class actually contains the "main()" method). Click "Finish"
6. Open your file explorer and double-click the resulting JAR you just created.
 
Ryan Giomi
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan,

While I was typing out my reply to you I had a thought that perhaps it's not working because I did not capitalize in my code the .png. So I capitalized it, compiled it, and exported it (3 its)... and it worked. I could have sworn I came across that problem awhile ago with another program... I was cranking me brain to figure out what went wrong.

Anyway, thank you very much for your response. You helped me knock one part of the trouble-shooting process out. I am very grateful.

***********
***********
So here is the old code that created the confusion:


Here is the updated code:

The only difference is that I had to capitalize the .PNG. It came to me while looking at my background pic file. I wondered if the capitalization difference might be causing a little quirk... sure enough it was.

Once again, Nathan, Thanks!

[ January 25, 2007: Message edited by: Ryan Giomi ]
[ January 25, 2007: Message edited by: Ryan Giomi ]
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic