Wednesday, April 29, 2020

JRE and JDK

Java JRE

Difference between JVM, JDK, and JRE

  • JVM - Java Virtual Machine is a virtual machine which runs programs which are compiled to bytecodes. The JVM is detailed by a specification that formally describes what is required in a JVM implementation. Having a specification ensures interoperability of Java programs across different implementations so that program authors using the Java Development Kit (JDK) need not worry about traits of the underlying hardware platform.
  • JDK- JDK is a wrapper around the JRE and additionally contains the compiler, interpreter, debugger and other tools. It provides users with features to run as well as develop Java programs.
  • JRE- JRE is made up of class libraries, JVM and supporting files

Conversion process- [JAVA .class file into back to SOURCE code]

Step 1: Download JAD tool from https://bit.ly/2XuRzT5
Step 2: Extract the zip file and get jad.exe.
Java Decompiler
Step 3: Create a .java file (DecompilerDemo.java) in the same folder in which you have extracted the zip file.
Step 4: Compile and run the .java file. It will generate a .class file in the respective folder.
Java Decompiler2
Step 5: Now move the .class file and jad application to another folder.
Java Decompiler3
Step 6: Type the command: jad DecompilerDemo
Java Decompiler4
Above command generates a .jad file in the respective folder.
Java Decompiler5
Step 7: Type the command: jad ?s java DecompilerDemo
Java Decompiler6
It generates the .java file in the same folder.
Java Decompiler7
Open the DecompilerDemo.java we get the following code:


JAVA class Decompiler

Options
With javap command, many options are available. Some of them are:
  • -c: It prints disassembled code.
  • -p: It shows all classes and members.
  • -s: It prints internal type signatures.
  • -constants: It shows static final constants.

Python Challenges Program

Challenges program: program 1: #Input :ABAABBCA #Output: A4B3C1 str1="ABAABBCA" str2="" d={} for x in str1: d[x]=d...