Solved

I need to create SIMPLE .class file, without compiler

Posted on 2004-04-01
9
198 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
Comment Utility
I hope, this would help your need

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

Expert Comment

by:sciuriware
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:trymyservice
Comment Utility
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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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.

771 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

14 Experts available now in Live!

Get 1:1 Help Now