wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes What am I doing wrong? I get garbage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What am I doing wrong? I get garbage" Watch "What am I doing wrong? I get garbage" New topic
Author

What am I doing wrong? I get garbage

Nancy Bradley
Ranch Hand

Joined: Feb 25, 2004
Posts: 32
I try to create a jar file that contains a Rectangle.class and an applet Rectangle1 that will test Rectangle.class
This is what I wrote:
jar cf lab6.jar Rectangle1.class Rectangle.class
The lab6.jar file was created, but when I tried to run it I got a bunch of symbols. I run it by typing: java-jar lab6.jar
What did I do wrong?
Please help!
Thank you
Nancy B
Ashok C. Mohan
Ranch Hand

Joined: Dec 03, 2003
Posts: 75
You will have to edit the manifest file in the jar to point to your main class.
Try adding this line....
Main-Class: classname
Replace classname with your main class file name.


SCJP 1.4
Do not dwell in the past, do not dream of the future, concentrate the mind on the present moment.
Ashok C. Mohan
Ranch Hand

Joined: Dec 03, 2003
Posts: 75
If you are using an applet then try calling it from an html page like this...
<applet code=mainclassname.class
archive="jarname.jar"
width=120 height=120>
</applet>
make sure the html and jar file are in the same directory.
Nancy Bradley
Ranch Hand

Joined: Feb 25, 2004
Posts: 32
Thank you very much
Nancy B
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What am I doing wrong? I get garbage
 
Similar Threads
jar
Jar files
how to take the jxam exam
NullPointerException
jar file