Solved

I need to create SIMPLE .class file, without compiler

Posted on 2004-04-01
9
200 Views
Last Modified: 2008-03-04
Hi,
I am doing a project for school grade.
I need to do a compiler like thing.
It should convert a simple java code into java.class file
it can be simplest like
there is a public string variable, and it is printed....
I can give variable name and the code should generate .class file
I meant that a software that puts java class structure and then the insert the variable value
I would like it in Visual Basi, but if you can give me some guidelines then I can develop....
Thanks in advance
With regards
0
Comment
Question by:trymyservice
9 Comments
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10731611
I hope, this would help your need

http://www.openjit.org/docs/backend-internal/
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 10733900
Back in 1971 I broke my leg so I had to lay down for 6 weeks.
In that time I wrote a compiler for a bookkeeping machine.
The approach is simple: write a program that recognises words and output calls to methods that do what
the input wants. We call that a threaded code system. So it translates one language into another.


And do not try to duplicate a JAVA compiler for a school project: you will die in tears.

;JOOP!
0
 

Author Comment

by:trymyservice
ID: 10739102
I am sorry but I think that this has to do with JAVA and I need procedure not necessarly in VB.
Here is bit more I could find

Say in applet there is only one variable wstr="HELLO"
and if I make .class out of this (taking differnent value of wstr....)

Class file contains these data
Êþº¾ + somefixeddata + somevariabledata + HELLO + someanotherfixeddata

So if I can know how to generate  somevariabledata  then my problem is solved !!!!

so my solution will be adding these all data and save as .class file ....

need to know how somevariabledata varies ???

Thank you
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:trymyservice
ID: 10739105
I am sorry but I think that this has to do with JAVA and I need procedure not necessarly in VB.
Here is bit more I could find

Say in applet there is only one variable wstr="HELLO"
and if I make .class out of this (taking differnent value of wstr....)

Class file contains these data
Êþº¾ + somefixeddata + somevariabledata + HELLO + someanotherfixeddata

So if I can know how to generate  somevariabledata  then my problem is solved !!!!

so my solution will be adding these all data and save as .class file ....

need to know how somevariabledata varies ???
And sir, I know that I am not going for a compiler... just Manipulator or something like that !!!
Thank you
0
 

Accepted Solution

by:
RobCSP earned 63 total points
ID: 10739486
If you want to create a compiler the first step is create a lexical analyzer, i recommend you JFLEX,JFlex is a lexical analyzer generator for Java written in Java. It is also a rewrite of the very useful tool JLex [3] which was developed by Elliot Berk at Princeton University.

You can take an useful manual in http://www.ugrad.cs.ubc.ca/~cs411/docs/manual.html


I hope that it helps,
ROB
0
 
LVL 13

Assisted Solution

by:Webstorm
Webstorm earned 62 total points
ID: 10740259
Hi trymyservice,

Here, you can find the class format specification :

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#80959
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

815 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

12 Experts available now in Live!

Get 1:1 Help Now