Solved

I need to create SIMPLE .class file, without compiler

Posted on 2004-04-01
9
202 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 120
jar file executable 12 59
arguments to jar 5 35
Eclipse Java import and method not resolved 4 50
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

828 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