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

AWS Elasticache Memcached connection

https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/accessing-elasticache.html#access-from-outside-aws http://hourlyapps.blogspot.com/2010/06/examples-of-memcached-commands.html Access memcached https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/GettingStarted.AuthorizeAccess.html Zip include hidden file https://stackoverflow.com/questions/12493206/zip-including-hidden-files phpmemcachedadmin ~ phpMyAdmin or phpPgAdmin ... telnet mycachecluster.eaogs8.0001.usw2.cache.amazonaws.com 11211 stats items stats cachedump 27 100 https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/VPCs.EC.html https://lzone.de/cheat-sheet/memcached VPC ID Security Group ID (sg-...) Cluster: The identifier for the cluster memcached1 Creation Time: The time (UTC) when the cluster was created January 9, 2019 at 11:47:16 AM UTC+7 Configuration Endpoint: The configuration endpoint of the cluster memcached1.ahgofe.cfg.usw1.cache.amazonaws.com:11211 St...

Notes Windows 10 Virtualbox config, PHP Storm Japanese, custom PHP, Apache build, Postgresql

 cmd => Ctrl + Shift + Enter mklink "C:\Users\HauNT\Videos\host3" "C:\Windows\System32\drivers\etc\hosts" https://www.quora.com/How-to-create-a-router-in-php https://serverfault.com/questions/225155/virtualbox-how-to-set-up-networking-so-both-host-and-guest-can-access-internet 1 NAT + 1 host only config https://unix.stackexchange.com/questions/115464/how-to-properly-set-up-2-network-interfaces-in-centos-running-in-virtualbox DEVICE=eth0 TYPE=Ethernet #BOOTPROTO=dhcp BOOTPROTO=none #IPADDR=10.9.11.246 #PREFIX=24 #GATEWAY=10.9.11.1 #IPV4_FAILURE_FATAL=yes #HWADDR=08:00:27:CC:AC:AC ONBOOT=yes NAME="System eth0" [root@localhost www]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 # Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth1 IPADDR=192.168.56.28 <= no eff => auto like DHCP #GATEWAY=192.168.56.1 #BOOTPROTO=dhcp BOOTPROTO=static <= no eff ONBOOT=yes HWADDR=08:00:27:b4:20:10 [root@localhost www]# ...

Rocket.Chat DB schema

_raix_push_notifications avatars.chunks avatars.files instances meteor_accounts_loginServiceConfiguration meteor_oauth_pendingCredentials meteor_oauth_pendingRequestTokens migrations rocketchat__trash rocketchat_cron_history rocketchat_custom_emoji rocketchat_custom_sounds rocketchat_import rocketchat_integration_history rocketchat_integrations rocketchat_livechat_custom_field rocketchat_livechat_department rocketchat_livechat_department_agents rocketchat_livechat_external_message rocketchat_livechat_inquiry rocketchat_livechat_office_hour rocketchat_livechat_page_visited rocketchat_livechat_trigger rocketchat_message rocketchat_oauth_apps rocketchat_oembed_cache rocketchat_permissions rocketchat_raw_imports rocketchat_reports rocketchat_roles rocketchat_room rocketchat_settings rocketchat_smarsh_history rocketchat_statistics rocketchat_subscription rocketchat_uploads system.indexes users usersSessions https://rocket.chat/docs/developer-guides/sc...