Skip to main content

Note Win 8 Eclipse J2ME dev

Eclipse Version: Helios Service Release 1 Build id: 20100917-0705
eclipse-jee-helios-SR1-win32.zip
Java
JDK

OS: Windows 8.1 Pro N x64
Java JDK, JRE:

Version 8 update 73 ( build 1.8.0_73-b02 )
Both User/System JRE:

C:\Program Files\Java\jre1.8.0_73\bin\javaw.exe
Platform Product
1.8 1.8.0_73 http://java.sun.com/products/autodl/j2se C:\Program Files\Java\jre1.8.0_73\bin\javaw.exe true


file:///C:/WTK2.5.2_01/index.html

Welcome to the Sun Java Wireless Toolkit for CLDC. The version 2.5.2 release is available on both Windows and Linux platforms. The product documentation discusses both platforms.
Sun Java Wireless Toolkit Version 2.5.2_01 for CLDC is a Security Update that corrects vulnerabilities that might allow an untrusted application to execute arbitrary code. This can only happen if you obtain a malicious program and run it in an earlier version of the toolkit.

The only change between version 2.5.2_01 and version 2.5.2 is the security update, so references to version 2.5.2 on this page and in the documentation correctly identify the most recent feature release. The version 2.5.2 documentation remains valid.
The documentation in this release includes the following:
For your convenience, this JavaTM Platform, Micro Edition (Java ME) release includes the following API documentation:
The following additional API documentation is available online:



Version 2.5.2_01 for CLDC (Dec 4, 2008 3:22 PM)

Java vendor: Oracle Corporation

Java version: 1.8.0_66

Operating system: Windows 8.1

Operating system version: 6.3

Architecture: x86

Language: en

Installation directory: C:\WTK2.5.2_01\



http://www.vogella.com/tutorials/EclipseDebugging/article.html
https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fbreakpoints%2Fref-uncaught_option.htm

Terminated exit value -...

cmd /c emulator.exe -Xdebug -Xrunjdwp:transport=dt_socket,suspend=y,server=y,address=46417 -classpath C:\Users\Admin\AppData\Local\Temp\_eclipseme.tmpAdmin\ArchAngel8265968564617921586.launch\ArchAngel.jar -Xdevice:DefaultColorPhone -Xdescriptor:C:\Users\Admin\AppData\Local\Temp\_eclipseme.tmpAdmin\ArchAngel8265968564617921586.launch\ArchAngel.jad ArchAngel

Enter %temp% to clean temp data. Restart Eclipse to avoid terminated Emulator.
Or use Java Control Pannel

http://www.adam-bien.com/roller/abien/entry/what_are_the_options_of
https://stackoverflow.com/questions/30736498/why-eclipse-debugger-does-not-stop-on-scoped-exception-breakpoint-how-to-stop-o

https://en.wikipedia.org/wiki/MIDlet

Install JavaMe for Eclipse
http://eclipseme.org/docs/installEclipseME.html
https://www.rose-hulman.edu/class/csse/resources/csmobilegames/softwareInstallation/Eclipse/eclipse-j2me-configuration.html
https://docs.oracle.com/javame/config/cldc/rel/3.3/win/gs/html/getstart_win32/setup_eclipseenv.htm

Be careful with Eclipse debug break points.
It seem that when set too many break point could break Eclipse and it refuse to stop / break on line as expected.
Case study 4 class b AA d e  with about 30 or more break point.
After remove all break point then re add them then it work again.

J2ME has some override functions like run() paint() keyPressed(). These functions are longest (often) and most important and loop used most.
We can separate to many other funtions and then call it from paint(), run() ... But the base and skeleton / Thread / Main loop of App is based on these function.
So we should follow these function flow to debug App. Just like when we debug thread, flow of application in LibGDX or other thread.

The boredom of infinite boring loop hole vs always exceptions fire.
After a countless of exception metal rain firing, I encounter other loop hole boredom, now I wish I have an exception in the past :)

Deobfuscator
https://stackoverflow.com/questions/40442942/java-deobfuscator-supporting-variable-renaming

Eclipse disable Validation and Error Annotation
https://stackoverflow.com/questions/17037403/make-eclipse-ignore-all-errors-in-current-project
Sometime JAVA code that extracted/decompiled from JAR, .class file is obfuscated and very hard to read and re-compile. There are many optimized code  for example variable declare reduce, operator nested precedence ...
So there is somehow a way that original developer compile these optimized program. Can we recompile these program without error ? By configure compiler and / or IDE to match some point ?
After try config Eclipse to ignore error notice, Validation ... It seem that I can not re-compile obfuscated one.
So I have to back to previous solution is that make some change (to pass Eclipse/JAVA validation) before re-compile it.
This is a tedious task because of so many work have to do to make sure modified program is same as obfuscated. Many mathematical precedence order, variable declare, error index OutOfBound or NullPointer ... appear.

http://www.eclipse.org/community/eclipse_newsletter/2013/october/article2.php
Debugging highly complex applications.
Step-Into-Selection
One of the pain points when debugging non-trivial applications is the difficulty of stepping into a method (or function) when multiple methods are on the same line. Imagine that the execution of the program is currently interrupted at the following line:

result = subtract( multiply( add( a, b ), 3 ), 5 );  // line 20

C:\WTK2.5.2_01\lib
All J2ME class lib place here. We can use jar viewer liek jd-gui to view source code. These standard lib is well developed, It may be useful not only core lib but also the convention, business logic and how to build a java lib.

J2ME 3.0 Can old java game run on this new SDK ? as previous 2.5.x SDK.
http://www.oracle.com/technetwork/java/embedded/javame/javame-sdk/downloads/java-me-sdk-3-0-1849684.html

Working with obfuscated code something like hacking other than programming ?
https://github.com/dsasmblr/game-hacking
https://resources.infosecinstitute.com/encrypted-code-reverse-engineering-bypassing-obfuscation/#gref
https://arxiv.org/pdf/1704.02774.pdf

http://findbugs.sourceforge.net/manual/eclipse.html
https://blog.codecentric.de/en/2013/04/again-10-tips-on-java-debugging-with-eclipse/

Compare with app behavior in K-Emulator for inspect missing item like button, text... Sometime button not show but can be clicked:
When I debug this game, no button SKIP show. I just ignore and still click it (LEFT_KEY).
Then it turn to new case that I expected.
>>>>> run exception <<<<<
java.lang.ArrayIndexOutOfBoundsException
at f.a(+83)
at f.c(+27)
at f.a(+12)
at f.a(+62)
at f.g(+38)
at f.a(+23)
at b.j(+1226)
at b.paint(+281)
at javax.microedition.lcdui.Canvas.callPaint(+85)
at javax.microedition.lcdui.Display.repaint(+82)
at javax.microedition.lcdui.Display$DisplayAccessor.repaint(+14)
at javax.microedition.lcdui.Display$DisplayManagerImpl.repaint(+16)
at com.sun.midp.lcdui.DefaultEventHandler.repaintScreenEvent(+24)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+519)
>>>>> run exception <<<<<

Shift byte operatior
https://stackoverflow.com/questions/10910913/how-do-shift-operators-work-in-java

>>>>> run exception <<<<<
java.lang.ArrayIndexOutOfBoundsException
at f.a(+162)
at f.b(+24)
at f.a(+5)
at f.a(+62)
at f.g(+38)
at f.a(+23)
at b.j(+1226)
at b.paint(+281)
The line number of error log is not correct. We only judge it by compare the relative value. For example the f.a() has many value +12 +23 +62 and +162 ... So we can use these value to judge the position of Exception, function() that error occur. From 62 to 162 is a huge change, (100 value) so this a(+162) may be in far bottom of f.java (ab 1700 LOC).
In reality f.a(+162) seem to be at ab line 702.
     I think this incorrect line number is not a bug, if it is then not a high priority since it seem quite difficult to get exact location of Exception. There are many thing affected this, compiler is a very complex system software. System software example is OS (gigantic), drivers, compiler etc.

Refactoring tool, learn on the go.
As Refactor book by Martin Fowler, I see some refactor tool in Eclipse IDE and try to understand, using it.
It is important to have some source code that write in J2ME for reference. It very useful in some case that we want to refactor function, variable name etc. These source can be found on internet. I will update some more sample link. One is here:

J2ME API document: https://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/javax/microedition/lcdui/package-summary.html

Comments

Popular posts from this blog

Rand mm 10

https://stackoverflow.com/questions/2447791/define-vs-const Oh const vs define, many time I got unexpected interview question. As this one, I do not know much or try to study this. My work flow, and I believe of many programmer is that search topic only when we have task or job to tackle. We ignore many 'basic', 'fundamental' documents, RTFM is boring. So I think it is a trade off between the two way of study language. And I think there are a bridge or balanced way to extract both advantage of two method. There are some huge issue with programmer like me that prevent we master some technique that take only little time if doing properly. For example, some Red Hat certificate program, lesson, course that I have learned during Collage gave our exceptional useful when it cover almost all topic while working with Linux. I remember it called something like RHEL (RedHat Enterprise Linux) Certificate... I think there are many tons of documents, guide n books about Linux bu

Martin Fowler - Software Architecture - Making Architecture matter

  https://martinfowler.com/architecture/ One can appreciate the point of this presentation when one's sense of code smell is trained, functional and utilized. Those controlling the budget as well as developer leads should understand the design stamina hypothesis, so that the appropriate focus and priority is given to internal quality - otherwise pay a high price soon. Andrew Farrell 8 months ago I love that he was able to give an important lesson on the “How?” of software architecture at the very end: delegate decisions to those with the time to focus on them. Very nice and straight-forward talk about the value of software architecture For me, architecture is the distribution of complexity in a system. And also, how subsystems communicate with each other. A battle between craftmanship and the economics and economics always win... https://hackernoon.com/applying-clean-architecture-on-web-application-with-modular-pattern-7b11f1b89011 1. Independent of Frameworks 2. Testable 3. Indepe