Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

making a .jar - error

 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good evening everyone,

thanks for looking at my post. I apologise in advance if this is in the wrong place.

I use textpad to write, compile and run my code. I've just finished a simple 2D java game for an assignment. The game runs perfectly when ran from textpad.

The files are located in C:\Keshan Pillay\brick

I used the command:

C:\Keshan Pillay\brick>jar cmf run.txt brick.jar *.*

I have defined my main class in run.txt, and didn't forget the carriage return.

My program contains several (5) .class files, a jpeg, and a MIDI file.
After issuing the command, I open the resulting .jar file with winRAR, and all the files are present, and opening the manifest, the main class has been assigned correctly. However, when I double click the .jar nothing happened. So I read somewhere that I need to change the exe I use to open the .jar. I was told to change the association to javaw.exe to open .jar files. Which I did. Now when I double click on the .jar I get this error:

"Could not find the main class. Program will exit!"

I'm rather confused as to whats happening. I would really appreciate it if anyone could advise me.

Many thanks,
Keshan Pillay
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Keshan Pillay:

......
opening the manifest, the main class has been assigned correctly. However, when I double click on the .jar I get this error:

"Could not find the main class. Program will exit!"

I'm rather confused as to whats happening. I would really appreciate it if anyone could advise me.

Many thanks,
Keshan Pillay


I doubt, may be your package hierarchy causes problem

If your main class is inside package bin.class then your manifest file must contain
 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, me being a beginner, I really didn't understand that...
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Keshan,

Please go through this link.
This may help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic