MiniJVM is simple java virtual machine written by python language, it can load class file from file system and run it.

Overview

MiniJVM

MiniJVM是一款使用python编写的简易JVM,能够从本地加载class文件并且执行绝大多数指令。

支持的功能

1.从本地磁盘加载class并解析

2.支持绝大多数指令集的执行

3.支持虚拟机内存分区以及对象的创建

4.支持方法的调用和参数传递

5.支持静态代码块的初始化

不支持的功能

GC,类文件校验

使用的方式

git clone https://github.com/keguoyu/MiniJVM.git

git checkout main

命令行启动:

python3 main.py -classname ~/CLASS_NAME CLASS_NAME是你需要加载的目标class文件

main.py支持传递更多的参数,如下:

[-h] ==> 查看帮助

[-v] ==> 查看版本信息

[-d] ==> 开启指令执行debug,开启之后可以看到类加载和指令执行的过程

[-cp] ==> class文件的目录路径

[-cn] ==> 目标类的类名

[-jre] ==> jdk安装的路径(在某些Mac上通过python获取JAVA_HOME的环境变量无法获取,可以通过这种手动指定的方式去指定)

在MiniJVM工程的跟路径下,又一个HelloJava的class文件,可以使用如下指令去执行该类:

python3 Main.py -d true -cp ~/AllFiles/WorkSpace/Python/MiniJVM -cn HelloJava -jre /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/contents/home/jre

可以看到指令运行的过程。

后续计划

增加GC,类校验以及更多指令

You might also like...
🤖🤖 Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... 🤖🤖

Jarvis 🤖 🤖 Jarvis is an virtual assistant which can some tasks easy for you like surfing on web opening an app and much more... 🤖 🤖 Developer : su

Py4J enables Python programs to dynamically access arbitrary Java objects

Py4J Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine. Methods are called as

This is a vscode extension with a Virtual Assistant that you can play with when you are bored or you need help..

VS Code Virtual Assistant This is a vscode extension with a Virtual Assistant that you can play with when you are bored or you need help. Its currentl

Tools for analyzing Java JVM gc log files

gc_log This package consists of two separate utilities useful for : gc_log_visualizer.py regionsize.py GC Log Visualizer This was updated to run under

Check broken access control exists in the Java web application
Check broken access control exists in the Java web application

javaEeAccessControlCheck Check broken access control exists in the Java web application. 检查 Java Web 应用程序中是否存在访问控制绕过问题。 使用 python3 javaEeAccessControl

Python plugin/extra to load data files from an external source (such as AWS S3) to a local directory

Data Loader Plugin - Python Table of Content (ToC) Data Loader Plugin - Python Table of Content (ToC) Overview References Python module Python virtual

Automatically load and dump your dataclasses 📂🙋

file dataclasses Installation By default, filedataclasses comes with support for JSON files only. To support other formats like YAML and TOML, filedat

A class to draw curves expressed as L-System production rules
A class to draw curves expressed as L-System production rules

A class to draw curves expressed as L-System production rules

Load dependent libraries dynamically.

dypend dypend Load dependent libraries dynamically. A few days ago, I encountered many users feedback in an open source project. The Problem is they c

Owner
keguoyu
Take nothing for granted
keguoyu
🎉 🎉 PyComp - Java Code compiler written in python.

?? ?? PyComp Java Code compiler written in python. This is yet another compiler meant for babcock students project which was created using pure python

Alumona Benaiah 5 Nov 30, 2022
A simple and easy to use Python's PIP configuration manager, similar to the Arch Linux's Java manager.

PIPCONF - The PIP configuration manager If you need to manage multiple configurations containing indexes and trusted hosts for PIP, this project was m

João Paulo Carvalho 11 Nov 30, 2022
Tracking development of the Class Schedule Siri Shortcut, an iOS program that checks the type of school day and tells you class scheduling.

Class Schedule Shortcut Tracking development of the Class Schedule Siri Shortcut, an iOS program that checks the type of school day and tells you clas

null 3 Jun 28, 2022
This is the Quiz that I made using Python Programming Language. This can only run in the Terminal

This is the Quiz that I made using Python Programming Language. This can only run in the Terminal

YOSHITHA RATHNAYAKE 1 Apr 8, 2022
Process RunGap output file of a workout and load data into Apple Numbers Spreadsheet and my website with API calls

BSD 3-Clause License Copyright (c) 2020, Mike Bromberek All rights reserved. ProcessWorkout Exercise data is exported in JSON format to iCloud using

Mike Bromberek 1 Jan 3, 2022
run-js Goal: The Easiest Way to Run JavaScript in Python

run-js Goal: The Easiest Way to Run JavaScript in Python features Stateless Async JS Functions No Intermediary Files Functional Programming CommonJS a

Daniel J. Dufour 9 Aug 16, 2022
Transparently load variables from environment or JSON/YAML file.

A thin wrapper over Pydantic's settings management. Allows you to define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and documentation for your defined configuration.

Lincoln Loop 90 Dec 14, 2022
Python implementation of an automatic parallel parking system in a virtual environment, including path planning, path tracking, and parallel parking

Automatic Parallel Parking: Path Planning, Path Tracking & Control This repository contains a python implementation of an automatic parallel parking s

null 134 Jan 9, 2023
Todos os exercícios do Curso de Python, do canal Curso em Vídeo, resolvidos em Python, Javascript, Java, C++, C# e mais...

Exercícios - CeV Oferecido por Linguagens utilizadas atualmente O que vai encontrar aqui? ?? Esse repositório é dedicado a armazenar todos os enunciad

Coding in Community 43 Nov 10, 2022
This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

PyJava This library is an ongoing effort towards bringing the data exchanging ability between Java/Scala and Python

Byzer 6 Oct 17, 2022