0

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?

Harshul Pandav
  • 1,016
  • 11
  • 23
  • 1
    That might depend on the original Java version and the decompiler. Note that not all decompilers can handle the newer features of Java correctly. Besides that, you might want to be more specific in how those files differ or what exactly doesn't work. – Thomas Mar 22 '12 at 07:21

2 Answers2

1

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

jmj
  • 237,923
  • 42
  • 401
  • 438
1

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?

Community
  • 1
  • 1
huelbois
  • 6,762
  • 1
  • 19
  • 21