Solved

Java

Posted on 2007-03-18
8
172 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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
 

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

803 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