简体   繁体   English

从.java文件创建.class文件 - J2ME

[英]Create .class file from .java file - J2ME

Using java decompiler a .class file was converted to .java which needed some code change. 使用java反编译器,.class文件被转换为.java,需要进行一些代码更改。

However how do I compile this java file? 但是我该如何编译这个java文件?

Using jdk1.5 it doesn't compile this file similar to the original class file. 使用jdk1.5它不会编译此文件类似于原始类文件。

Which compiler do I need to use in this case? 在这种情况下我需要使用哪个编译器?

using IDE it would be far easier, 使用IDE会更容易,

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 安装Netbeans,创建移动应用程序项目,在源目录中复制您的java文件,构建项目并从目标目录中获取.class文件

To compile for the J2ME platform, you need some specific tool. 要编译J2ME平台,您需要一些特定的工具。 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 - ). 上次我必须这样做(4年前,可能已经改变),我需要SUN J2ME SDK(现在:Sun Wireless工具包: 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). 此SDK(包含J2ME模拟器)允许对生成的.class文件进行一些修改,一些预先检查包括.class文件中的附加信息(预验证)。 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? 这是SO中的一个链接,关于这个主题的问题(和答案): J2ME应用程序的预验证是什么意思?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM