Java byte code spec
Hi, I'm interested in learning more about Java byte codes, but I can't find any kind of specification or other document describing them. Do you know where I could find such document?
Hi,
it's here
http://java.sun.com/docs/books/jls/index.html
Download is available at the bottom of that page
greetings Marsian
Similar Messages
-
Java Byte Code --- Normal Java Code(Text)
I m making an application IDE(C/C++) for Java, In this I want to give Option to convert Java Byte Code to Normal Java Code(Text).........For This tell me how to do it.
See the page
http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/javap.html
for a description of javap.exe, the Java class file disassembler. -
recently i came across an idea where a it read something about changing a SVG file into java byte code. can anyone give me idea about what i means and what are the applications for someone to do such a thing. i thing just flew right over my head, does anyone have any idea about this at all.
thanksAs I recall, there is a xml standard for SVG files. You don't change SVG files into byte code directly. Instead, you interpret the file and create objects. e.g.
public Shape[] getShapesFromSVGFile(File f) throws IOException;
Then draw them like any other shape. -
Is Java Byte Code is 100% platform independent
Hi all
A my room fellow is disturbing me about the platform independency of JAVA.
Now i only wan to know that generated Byte Code will be same if it is generated on different platforms (Window,Linux,Unix etc)using their respected JVM
Thanks in advanceThe "Platform Independency" of Java is a bit of a joke
to me. You need a JVM that is platform dependent to
run it. Now granted, you can write one application
and itll run on any platform, but that's only assuming
they have the JVM installed on them. Not to say that
Java isn't cool and all, but the "platform
independency" solution still has a reliance on
something that is platform dependent... It's like
driving an automatic and saying you can drive....Sure,
you are making the car go, but something is doing the
shifting for you....(C: I guess I'm just arguing for
the sake of arguing...Well if you want to argue that point then no language is platform independant. C code for instance needs a compiler for the platform you want to compile it to run on and that compiled code won't work on any other platform. Ultimately every program has something that ties it to a particular platform, that's just the nature of things in computers.
The idea of platform independance was the removal of the need to re-compile a program with a native compiler just to get it to run on that platform.
Instead Sun opted to have a compact JVM to interpert the byte code and have the byte code standard across all implementations of the JVM. -
Question about compiled byte code
Howdy folks,
I have a client who wants to run an application in both
on-line and off-line modes. The user could run the application
locally on their laptop making changes and such which would get
stored to local database files (probably FoxPro free tables just to
make it easier on me). Then when the user got back to their
internet connection they could run the application and it would
sync with the online tables (probably MySql tables at that point).
So the question is, if I compile Cold Fusion code into Java
byte code, will it be able to execute independantly of the Cold
Fusion Server? I realize that I could load ColdFusion on the user's
laptop, but I don't think I want to do that. I'm assuming that the
answer to my question will be "No. You can't do that. Cold Fusion
isn't meant to work like that." To which my next question would be,
"Well, what language would be best for the type of application I
have described above? Action Script, maybe?"
Any thoughts are welcome, especially if you've written an
application like the one I've described.
Thanks very much,
ChrisWell, rats.
I wrote a nice reply to your message BKBK, but lost it
because, apparently, my session timed out.
The basic jist, was that I've been working on AJAX, and have
been implementing some AJAX-like techniques at some other clients
(using hidden iframes combined with innerHTML -- I know not a
standard, but darn handy otherwise), but I couldn't see how that
would solve my on-line/off-line problem (unless I stuck with the
cookies idea).
I also did some reading on cookies last night (obviously, I
don't use cookies very often if at all in my daily coding), and I'm
a bit put off by the different browser limitations. I'd hate my
client to be chugging along, entering appointments into the
"database" (read: data being stored as cookies to be sync'd later
when the user goes online), and then suddenly run into the cookie
limitation. On top of that, if I'm reading right, IE (my client's
most likely choise of browser), will not let you know that you've
reached this limit, but will just begin dropping the older cookies
in favor of the newer ones. If I could programmatically sense this
limitation and then write the cookies to some file before
continuing that'd be geat, but since JavaScript can't write files
(that I know of) this isn't feasable. Also, if I could write a file
like that, I wouldn't bother with the cookies.
I think I'm going to end up writing it in FoxPro since my
company has a bunch of copies of it (and it's licenced per
developer and not per copy), and there are lots of folks in my
company who can help me get up to speed. That also means that I'll
probably need to write a web version of the code for when my
client's client's (does that make sense? :-) ) connect to the app
via the internet.
Anyway, I'm really enjoying everyones comments on the
subject. Can anybody think of a technique for a way around the
cookie limitations? Or perhaps another language that this whole
thing could be written in?
I really wish that I could compile my ColdFusion code for use
independant of the CF server. I know, that's not the way it works
and typically not what scripting languages like this are used for.
I suppose I could always install the developer's version of CF on
the user's local machine, write the code in CF and then just detect
whether or not the user is online and behave accordingly. -
Executing tiny programming language compiled byte code with the JVM
Hello,
For a project, I am developing a simple programming language, with a syntax not unlike Pascal, which compiles to Java Byte Code. Currently I execute the compiled byte code using my own interpreter. This works OK, but what I'd like to do now is to execute the compiled byte code using the actual existing JVM. The compiled byte code resides in a text file upon compilation of a sample program written in my tiny programming language. Does anyone know how I may start to go about this? Thanks in advance.
adamThe only way of getting a standard Java virtual machine to execute your java byte code, is to wrap it up into a completely valid java class file.
Any constants you use, must be put into the classes constant pool.
Any local variables will have to go into the local variable table of the method which uses them... etc, etc.
Something like ASM, would let you dynamically create a Java class file.
http://asm.objectweb.org/
regards,
Owen -
Hi,
im a fresher in java
im trying to develop my own java decompiler which translates class file to java file ,can anyone help me please how to start and give some guidelines .. wud b really helpful
looking forward for your support .. thanks !!A decompiler is a very advanced project to take on, not for a "fresher".
1. You must write a disassembler first.
This involves being able to parse the binary class file, and convert it into java
byte code instructions.
As mentioned, the class file format is documented here, and is the sole reference I needed to write a disassembler.
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html
2. After you have the disassembled instructions, you can then try to reassemble
them into higher level java source code.
This isn't a trivial project.
In my free time, I spent ( on and off ), 1 year writing my own disassembler to support Java 1.5, and I haven't even attempted a decompiler ( yet ).
It has 279 classes, most fairly complex.
Just to give you an idea of my experience, 7 years java, 5 years C++ and assembly. And you'll need some experience/concepts of assembly language to work out the stack frame to break the java byte code instructions into java statements.
In my opinion, you're better off experimenting with the BCEL ( byte code engineering lab ), to extract details about the class file.
regards,
Owen -
Byte Code Manipulation vs. Preprocessor
Hello,
I'm not sure if I'm asking this in the right forum or not, but if I'm not, please let me know and I'll change it asap.
I�d like to know what the advantages associated with byte code manipulation are.
For instance, if one had the option, why wouldn�t anyone prefer to use traditional pre-processor methods of altering java code as oppose to byte code manipulation (ie. with javassist or ASM)? -- in respects to porting J2ME apps over a variety of cellphones.
Thanks,
Marksee I was just trying to use BCEL to learn about it. I
want to manipulate the class files. So no point comes
of a different solution.Why nobody is giving me the
solution that I want...Is it b'coz its not possible
with BCEL or what....Please help...
Kindly and please give the replay based on the BCEL.
Thanking you,Initially, you stated that your problem was how to debug production code that may or may not have debugging code present - to which you have been given an answer. If, however, your goal is a purely academic exercise (this has all the earmarks of one, especially since this won't do one bit of good in real life) then you are perhaps misunderstanding what BCEL is. You can't insert System.out.println(...) statements with it, since those are uncompiled java source lines - instead you need to insert compiled bytecode instructions, which will look more like this:
34 invokevirtual #9 <Method java.lang.String getQuery()>
37 invokevirtual #7 <Method void println(java.lang.String)>
40 getstatic #5 <Field java.io.PrintStream out>which I wouldn't think is very useful. I can't suggest strongly enough that you consider not running a binary classfile mutating application on production code - that is a very bad idea.
As I see it, you have two options: compile two different binaries, one for debug and one for release; or use a flexible logging system (which I have done in every case). A third option of course is to continue playing around with BCEL for the purpose of learning the java bytecode world (but if you really want to do that, I suggest you write your own classfile disassembler using the Sun VM spec - it isn't as hard as you think and extremely educational) - but don't inflict a production application with a poor design simply to satisfy a whim. -
Hi Friends
While Configuring EP system with SOLMAN 7.1 SP12 it is giving below message in self Diagnosis Phase.
1. Solman system is already having ISAGENT version 8 and 9 installed (but Managed system is having 8)
2. I have followed the automatic Process as below
==========================================
Automated Installation of the Introscope Agent via SMD
The Solution Manager provides an application that performs the setup of the Introscope
byte code agent for Java automatically. This section explains the steps to run the setup.
Before you can run the Introscope agent setup, the setup wizard for the managed system
must have been executed.
1.
2.
3.
4. Launch the Introscope Setup application: SAP Solution Manager Configuration
Managed Systems Configuration Step 7 Configure Automatically Automatic
Activity “Byte Code Adapter Installation” “Open Java URL” (only available in edit
mode). Your screen will look similar to the image below:
5. Check the Enterprise Manager Settings at the top of the screen. These are the
connection parameters that will be used by the agent to connect to the Enterprise
Manager.
6. In the pane Introscope Agent Setttings, select the system that you want to instrument
with the agent. Check “select all” and click “Retrieve Current Settings”. This will display
the current status of the agent setup.
7. To initially setup or update the agents, click Setup Introscope Agent …. This will open
the setup dialog as shown below. Select the desired agent version (by default only one
available) and choose the profile. Next, check the desired instrumentation areas, and,
in the case of AIX, review the AIX settings to match your environment (J9 or classic
mode).
8. Finally, hit Apply to perform the necessary changes in the agent configuration. Agent
config files will be adapted and the Java VM parameters will be set as required for the
managed system.
================================================================
3. Restarted SAP but error still present.
Please help to resolve the issue.
ThanksFound the solution :
1819577 - Workload Analysis data missing for Java systems when using ISAGENT 8.2.4.0
Cause
l This issue has been identified as product defect and documented in note 1273028
Resolution
l As mentioned in note 1273028, update to ISAGENT 8.2.4 Patch 1 timestamp: 2012-06-26, please proceed as described below)
1. Enable the Maintenance Mode in the Agent Administration UI (http://solmanserver:port/smd/AgentAdmin)
2. Deploy the file to the Solution Manager JAVA stack using the Software Deployment Manager (SDM)
3. Disable the Maintenance Mode in the Agent Administration
4. Execute again the activity 'Byte Code Adapter Installation' of the step 'Configure Automatically' in the 'Managed System Configuration' for the
affected systems. This activity will deploy the new version of the
Introscope JAVA agent in the managed system servers and reconfigure the JVM parameters to use the new version of Introscope JAVA
Agent;
5. Check from Introscope Agent Admin if "IS Agent State" contains value "Running but needs restart"
6. Restart the affected managed system(s)
Finally Solution is update your SOLMAN system patch ISAGENT 8.2.4.0 from patch 0 to 1 via SDM.
Thanks
Mukesh -
Hello...can anyone tell me how I write a java program, compile it and get my byte code written into another file??
Thanks in advance!I am looking to write my bytecode into a .bc file and
open it and actually be able to read the bytecode
instruction...(stuff like iload_2, i2d etc.,)I see... that was not clear from your first question. What you want is a disassembler. The SDK comes with one called 'javap': http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/javap.html -
Inheritance and byte-code...
My coworker and I were having a discussion today that I imagine someone here will be able to resolve for us: we were talking about how wonderful inheritance is (when used properly, of course), and the issue of the compiled byte-code came up.
Basically, it was my conclusion that a subclass contains only the byte code that differentiates it from the superclass; in other words, if a superclass is modified and recompiled, there is no need to recompile the subclass for the changes to take effect. My coworker disagreed, however, arguing that there would be linking problems between the two classes if the subclass was not recompiled (sign of an old assembly programmer, if you ask me).
Anyone know the answer to this?I created a trivial Parent class and extended it with an
even more trivial Child class. I compiled both classes
and then made a change to the Parent class. After
compiling the Parent class only, the change took effect
in the Child class. This indicates that you are right and
your co-worker is wrong. Here are the classes if you
would like to show him.
import java.awt.*;
public class Parent
Dimension d;
Parent() {
d = new Dimension(333, 777);
public Dimension getDimension() { return d; }
import java.awt.*;
public class Child extends Parent
Dimension d;
public Child() {
d = getDimension();
System.out.println(d.height + " " + d.width);
public static void main(String[] args) {
new Child();
}Mark -
Access Java Proposals for a java source code programmatically
Hi,
Problem
Programmatically get java proposals for a java source code (not byte code) via eclipse bundle
Description
I am developing one eclipse osgi bundle to correct java source code automatically. I am running osgi bundle inside eclipse itself [Version: Mars Release (4.5.0)]. I am able to get java project object and a class object inside it which I want to correct. Every time I try to collect java code proposals as I put one test file which can be corrected (like duplicate imports), I receive below error:
Java code line
JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { problem }, proposals);
Error description
!ENTRY org.eclipse.jdt.ui 4 2 2015-07-27 18:57:09.196
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".
!STACK 0
java.lang.IllegalStateException: Workbench has not been created yet.
at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:236)
at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:227)
at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:741)
at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
at org.eclipse.jdt.internal.ui.text.correction.AssistContext.getASTRoot(AssistContext.java:119)
at org.eclipse.jdt.internal.ui.text.correction.LocalCorrectionsSubProcessor.addUnusedMemberProposal(LocalCorrectionsSubProcessor.java:669)
at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:530)
at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:316)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:378)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:339)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:335)
at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:468)Any code from org.eclipse.jdt.ui (or the non-API code in org.eclipse.jdt.internal.ui) is likely to require a running workbench. Only the code from org.eclipse.jdt.core is guaranteed to work headlessly.
-
Strange Error - 5005: Unknown error optimizing byte code.
Hello flashcoders,
I am facing strange problem since long time. This error code
even doesn't exist in the list of error codes.
This is the exact error I am getting while I compile the FLA
from flash CS3.
Location : , Line 1
Description : 5005: Unknown error optimizing byte code.
Source :
I don't know exact reason about its generation, But here are
the some possible reasons / hints:
Case 1) Overloading:
1.1) Size of .fla is 10.5 MB and its document class contains
more than 60 classes to import and has more than 100 variables.
1.2) Even if I put In document class - only variable
initialization and class importing are there. Nothing in its
constructor + no other functions are defined. Still error is there.
1.3) If we import all classes and has all variables then it
gives this compile error. But if we remove some particular numbers
of variable, it's start working. In this we can remove any type of
variables.
1.4) After reducing variables, application starts working
till that it won't.
Case 2)
2.1) Size of .fla is 1.75 MB and its document class is same
as above one.
2.2) All assumptions are same as above.
2.3) Now this class contains all functions and have
initialization of all variables + classes.
2.4) In this If we remove 3-5 variables, it will start
functioning else it won't.
Its a huge application so I am even confused that what is the
cause of error and this error stopped our working for a week now.
Bit more information about the project that may help the team to
identify the reason.
1. Project development started with flash public alpha 3.
When we started using Flash CS3, we had some design problem if we
do open the FLA in CS3, so we completely redesigned the Movieclips
etc., in Flash
CS3 IDE.
2. Project contains approx 250 classes.
3. In main application, it imports 67 classes. (it works if I
keep 63 classes in document class).
4. In the case 3 above, if that works with 63 classes and If
I do add 3 frames in existing movieclip, it stops working.
5. In the case 3 above, if that works with 63 classes and If
I do add / declare few more variables, it stops working.
It would be humble appreciation if someone can come up with
some light in the dark tunnel.
Best Regards,
Ashvin Savani - "arckid"
Founder & CTO - Avinashi.com
Adobe Community Expert
We Never Give Up!I've posted an article on this problem -
http://www.negush.net/blog/5005-unknown-error-optimizing-byte-code/
- and here are a few ideas on how to handle it (check out the
comments):
- try turning off the optimizer
- delete ASO files
- also it seems that changing the java vm heap memory size
could help (find he environment variables in the Windows computer
properties and search the JAVA_TOOL_OPTIONS variable) -
Anybody write Java assembly code?
I recently stumbled onto the Jasmin (http://jasmin.sourceforge.net/) and BCEL (http://jakarta.apache.org/bcel/) projects and have a question for all the Java developers out there.
Have any of you ever written Java assembly/byte code directly instead of writing Java source code? You're probably asking "why the hell would someone write Java bytecode when they have a great high-level language like Java?" Well that's what I want to find out. Why would you write Java assembly code? What cool things have you done with Java assembly code?-insert tracing instruction before every executable statement of code for dynamic coverage analysis.
-insert timing instructions at the top and bottom of every method for dynamic profiling
-generate dynamic stubs/ adapter code
Folks generally don't program using java assembly, as far as I know, but use these tools to programmatically create/alter code. -
JDK 64k byte code limitation for methods
Concerning the JDK 64k byte code limitation for methods (actually 65535 bytes): While the Java compiler doesn�t care for that problem, the Java VM does. Hence, an violation of the 64k limit is dedected at run time, too late, of cource. Is it possible to detect the violation at (or immetiately after) compile time? Are there any tools that support the perception of the violations as early as possible?
Thanks to the authors of the answers. I agree to you as far as hand-written code is concerned. However, we generate our java classes, thousands of files, each java class with a lot of methods. We do have rules to keep things as smal as possible. Nevertheless, some methods become very large. Thus the problem is to detect such methods. Once the methods are known, we are able to modify our generator. We implemented a small program that looks for large methods in terms of source code, but there is just a week correlation between source code and byte code. Hence, again the question: Is there a tool that supports the detection of methods larger than 64k byte code before installation?
Maybe you are looking for
-
IPod not Charging, or Connecting to iTunes when Plugged into the Computer
I cracked the screen a few weeks ago. When I plug it into the computer, it does not charge, and it is not recognized. BUT, if I use the same USB cable, I can charge it using a wall charger.
-
How to remove an Element from XML by confirming Attribute of that element
Hi guys I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and sa
-
Hey there, I have an iPhone 3g that was synced to my computer. My computer got stolen with all my music on it. I have a new computer but I can't sync my computer to my iPhone. How can I recover everything that's on my iPhone 3g to my computer?
-
IOS 7: Problem saving photos from Safari
When I choose Save Image from an image in Safari (by holding down on the photo) the photo does not save and instead a photo I took weeks ago appears in my photo album as the thumbnail and when you open the image it's blank.
-
Error message tells me to reset password. After resetting password I get confirmation email that new password is set. As soon as I try to access App Store I get error message that password is not valid.