Harshul Pandav
Harshul Pandav

Reputation: 1036

Create .class file from .java file - J2ME

Using java decompiler a .class file was converted to .java which needed some code change.

However how do I compile this java file?

Using jdk1.5 it doesn't compile this file similar to the original class file.

Which compiler do I need to use in this case?

Upvotes: 0

Views: 3320

Answers (2)

huelbois
huelbois

Reputation: 7012

To compile for the J2ME platform, you need some specific tool. Last time I had to do this (4 years ago, may have changed), I needed the SUN J2ME SDK (now: Sun Wireless toolkit : http://www.oracle.com/technetwork/java/index-jsp-137162.html - ).

This SDK (which contained a J2ME emulator) allowed to do some modification to the .class files generated, some pre-check that included additionnal information in the .class files (preverification). Without them, the code wouldn't run (I tried to do the same thing as you do, with a legacy application).

Here is a link in SO which a question (and answer) about this subject: What does preverification of J2ME application mean?

Upvotes: 1

Jigar Joshi
Jigar Joshi

Reputation: 240860

using IDE it would be far easier,

Install Netbeans, Create a mobile app project ,Copy your java file in source dir, Build the project and grab the .class file from target dir

Upvotes: 1

Related Questions