0

I have decompiled a jar file,

enter image description here

and made two classes from it. After that, I tried to make a new jar file with these two class files, using this code

jar cvf AB.jar WinRegistry.class StartPageChangeApplet.class

The file created without any errors. However, when I look at the source code on Java Decompiler, it says "Internel Error", means that I couldn't make the jar file properly.

enter image description here

Where am I doing doing wrong ?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user198989
  • 4,574
  • 19
  • 66
  • 95
  • 1
    What are you doing to execute that jar ? – Bhavik Ambani Dec 08 '12 at 14:48
  • You should really better explain what it does not work. Moreover, remember that if you use packages, you should add the complete path of each class. – eppesuig Dec 08 '12 at 14:55
  • Maybe you can have a look here: http://stackoverflow.com/questions/4309834/can-i-execute-two-different-classes-from-same-jar-file or here http://stackoverflow.com/questions/3976514/multiple-runnable-classes-inside-jar-how-to-run-them – tim_a Dec 08 '12 at 14:58
  • It probably means that your Java decompiler has a bug, or can't read class files generated with your compiler. To check that the jar is OK, execute a Java program which loads the classes in the jar. – JB Nizet Dec 08 '12 at 15:36

2 Answers2

1

Please define "made two classes from it". Which java compiler (e.g. javac.exe) are you using? Did you just copy the source to a .class file without compiling maybe?

The java decompiler JAD actually displays source code, not class bytecode. Don't get confused by the title of the editor which is saying WinRegistry.class.

So you can't just save that as a .class. You need to save it as a .java and then compile it to .class using a java compiler:

javac WinRegistry.java StartPageChangeApplet.java
jar cf AB.jar WinRegistry.class StartPageChangeApplet.class
mhaller
  • 14,122
  • 1
  • 42
  • 61
1

From Eclipse, you can do this way.. enter image description here

ChanGan
  • 4,254
  • 11
  • 74
  • 135