• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to create JAR(executable) in Windows...  RSS feed

 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created a mediaplayer in Java,using JMF...
i wanna make it run on double click..
i have tried it using
jar cvfm M.txt JPlayer.jar *.*


where M.txt contains

Main-Class: MyPlayer

my Player starts from MyPlayer class thats why...

can anyone please help me

thanks in advance
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The manifest file is expected to have an extension ".mf"
Check this out http://java.sun.com/docs/books/tutorial/deployment/jar/
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Maneesh,

it's working ..

But you know when i moved jar file to another folder its running but not loading any images.
i have tried again by copying that images folder.Then it worked.....
can anyone fix this issue
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the images in the jar file? How are you loading them?
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have added couple of images in the Labels and these images saved in a folder named images.
While i am extracting that jar i could see that images folder.But while executing that jar its not showing any image
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like Ulf said, how are you loading those images in your code?
 
harilal ithikkat
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i used

 
Campbell Ritchie
Marshal
Posts: 56595
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should have super.paintComponent(G); as the first line in the paintComponent() method, not the last line. When you call super.paintComponent(g) you return your Component to its "initial" appearance, and your images are vanishing.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
harilal ithikkat wrote:icon = new ImageIcon(pic);//"images/login.jpg");

This will look for images/login.jpg on the file system. Use getClass().getResource("images/login.jpg") to retrieve a URL to the file inside the JAR file, then use that URL to create the ImageIcon.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!