jvm编译环境搭建 win Vc篇

/**************************************************************
技术博客
http://www.cnblogs.com/itdef/
 
技术交流群
群号码:324164944
 
欢迎c c++ windows驱动爱好者 服务器程序员沟通交流
**************************************************************/

 

win7英文(推荐)

下载JDK7

http://download.java.net/openjdk/jdk6

http://download.java.net/openjdk/jdk7(推荐)

http://download.java.net/openjdk/jdk8

下载visualstudio

社区版本 2015(建议使用2010版本)

下载cygwin

cygwin.com

微软下载SDK7.1

Microsoft windows sdk for windows7 and .net framework

ecilipse IDE java developer 版本 eclipse-java-kepler-SR2-win32

 

所有安装路径不要带空格带中文

C:\Program Files\Microsoft Visual Studio 12.0

这样的默认路径要修改

操作系统使用win7 32位版本

首先安装vs2010 

然后安装JDK7 进行路径设置(JAVA_HOME CLASSPATH)

安装 sdk7.1

 安装cygwin

安装的时候 将以下库勾选

 

Binary Name Category Package Description
ar.exe Devel binutils The GNU assembler, linker and binary utilities
make.exe Devel make The GNU version of the 'make' utility built for CYGWIN.
NOTE: See the GNU make section
m4.exe Interpreters m4 GNU implementation of the traditional Unix macro processor
cpio.exe Utils cpio A program to manage archives of files
gawk.exe Utils awk Pattern-directed scanning and processing language
file.exe Utils file Determines file type using 'magic' numbers
zip.exe Archive zip Package and compress (archive) files
unzip.exe Archive unzip Extract compressed files in a ZIP archive
free.exe System procps Display amount of free and used memory in the system

配置CYGWIN BIN 路径  C:\OpenJDKBuild\cygwin\bin

配置VC BIN 路径  C:\OpenJDKBuild\VS2010\VC\bin

命令行执行cl.exe时候

提示缺少mspdb100.dll

经过搜索 发现该文件在目录 C:\OpenJDKBuild\VS2010\Common7\IDE

将这个路径也配置到 path环境变量中

 

我的PATH变量设置如下 

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\xxx>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\OpenJDKBuild\jdk1.7.0_80\bin;C:\OpenJDKBuild\jdk1.7.
0_80\jre\bin;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\OpenJDKB
uild\cygwin\bin;C:\OpenJDKBuild\VS2010\VC\bin;C:\OpenJDKBuild\VS2010\Common7\IDE

《深入理解Java虚拟机 JVM高级特性与最佳实践》一书还特别提到 需要将vs2010的BIN路径放到CYGWIN的BIN路径前面。不过我没这么做  也成功了.

 

环境配置完成 着手编译

开启命令行

进入openjdk\hotspot\make\windows 目录下

执行 VC TOOL 目录下的vsvars32.bat

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\xxx>cd C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows

C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows>C:\OpenJDKBuild\V
S2010\Common7\Tools\vsvars32.bat
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

接着 执行命令 create(jdk目录)

C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\make\windows>create C:\OpenJDK
Build\jdk1.7.0_80
**************************************************************
Will generate VC10 {Visual Studio 2010}
C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\build\vs-i486\jvm.vcxproj
**************************************************************
NOTE: Using the following settings:
HotSpotWorkSpace=C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\
HotSpotBuildSpace=C:\Users\xxx\Desktop\jdkdependacy\openjdk\hotspot\build\vs-i
486
HotSpotJDKDist=C:\OpenJDKBuild\jdk1.7.0_80
-- compiler1 --
-- compiler2 --
-- tiered --

然后VC的SLN文件便生成 就可以在VC中编译了

但是该VC工程可能生成的预编译配置 过了“号 需要去掉

如图

最后编译成功

 代码面前了无秘密  配合书籍文档 对于运行机制会有更深入的理解

posted on   itdef  阅读(329)  评论(0编辑  收藏  举报

编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示