简体   繁体   English

可以从类文件创建Java文件吗? 反编译

[英]can you create java file from the class file? Decompile

I recently created a project in Netbeans using VirtualBox on which i installed windows XP (Not activiated) My Windows required me to activate and would not allow me access to my files on the computer before i activate it, i stupidly went and uninstalled XP and reinstalled it, thinking i'll have access to all the files from the JAR file i created 我最近在Netbeans中使用VirtualBox创建了一个项目,在该项目中我安装了Windows XP(未激活)。我的Windows需要激活,并且在激活它之前不允许我访问计算机上的文件,我很愚蠢地去了并卸载了XP,然后重新安装它,以为我可以访问我创建的JAR文件中的所有文件

I want to know if theres any way i can use the class files of the project i created, to create new java files so that i can edit the code in netbeans ?? 我想知道是否有什么方法可以使用我创建的项目的类文件来创建新的Java文件,以便我可以在netbeans中编辑代码?

Please if anyone can shed some light on this topic, if its at all posible to gain access to the forms java content i created. 如果有人可以访问我创建的Java内容表单,请让任何人对这个主题有所了解。 Im new to programming and this is something above my knowledge (i hope this makes sense) 我是编程新手,这是我所不了解的(我希望这是有道理的)

If not possible please let me know what an absolute idiot i am, so that i can start re creating the project from scratch ... Sigh, and thank you 如果不可能的话,请让我知道我是绝对的白痴,这样我就可以从头开始重新创建项目了。抱歉,谢谢

A jar/class file is compiled bytecode that is not human-readable... but with Java it is easily converted back. jar / class文件是无法读取的已编译字节码... 但是使用Java可以轻松地将其转换回。 Look into a program like JavaDecompiler . 查看类似JavaDecompiler的程序。 1 This is not my program but I use it and I find it workable for my needs. 1这不是我的程序,但是我使用了它,并且发现它可以满足我的需求。

1 If this is considered spam I'll gladly invalidate the link. 1如果这被视为垃圾邮件,我将很乐意使该链接无效。

As a sidenote: You are lucky that its Java. 附带说明:您很幸运它的Java。 In many other languages like C++ that would hardly be possible. 在像C ++这样的许多其他语言中,这几乎是不可能的。 The difference is that Java does not compile the source code to machine code . 区别在于Java不会将源代码编译为机器代码 That step is hardly reversible since for example all variable names are lost. 该步骤几乎不可逆,因为例如所有变量名都丢失了。 Try to understand a non-trivial piece of code without helpful variable names... 尝试理解没有帮助的变量名的简单代码...

Java instead compiles the source code to byte code which then is interpreted by Java on runtime. Java会将源代码编译为字节代码 ,然后由Java在运行时对其进行解释。 That byte cold holds way more information about the original source code than machine code. 字节冷保留了有关原始源代码而不是机器代码的更多信息。

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

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