Solved

Java

Posted on 2007-03-18
8
168 Views
Last Modified: 2010-03-31
How do I know how large is the byte code of my program? I wrote a calculator program using java AWT.
0
Comment
Question by:shahrine99
  • 5
  • 3
8 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18746157
You can see the file size in your OS. For example if it is Windows, you can see the file size in Windows Explorer.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18746159
You can also write another program to do the same. You can load the file class information into a java.io.File object and use the length () method. See this example:

http://www.exampledepot.com/egs/java.io/GetLength.html?l=rel
0
 

Author Comment

by:shahrine99
ID: 18746171
so u mean, where I saved my program, I put my mouse over the file and I see a blog and it said size: 9.05 KB ..is dat how big my program is?
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 18746196
Yes that is how big your program is (assuming you pointed it on the .class file and not the .java file since you asked about the size of the byte code).
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:shahrine99
ID: 18746198
awesome...i learned something =)
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18746201
:-)
0
 

Author Comment

by:shahrine99
ID: 18746230
hey another question...on the main.java file..i see the size is 8,964. Is dat in KB, MB or wat?
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18746240
That is KB
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now