How can I compile Java code in Windows without installing the whole JDK?

泪湿孤枕 提交于 2020-01-03 10:20:34

问题


Let’s say the runtime environment (version 1.6.0_01-b06) is already in place, but since I lack administrative privileges in this particular PC, the JDK can’t be installed. So, is there any portable JDK or standalone Java compiler for Windows that doesn’t require installation?


回答1:


You might try taking the tools.jar file from the JDK (you would have to copy it over from another machine) and see if that worked.

javac is essentially a small exe that starts the VM with the specific class for the compiler.

Also, there is nothing (that I am aware of) about the JDK install that you couldn't do with a copy of it from another machine. So get on a machine you can install the JDK on, install it, and then copy the files to a place on the machine that you lack the rights to and it should work.




回答2:


You don't need to install JDK. Just copy it over from another machine, and set PATH to %jdk%/bin and JAVA_HOME to %jdk% (actually, only PATH is often enough). I do it all the time.




回答3:


Eclipse works very well. being a portable ide, it will use it's own jdk. I personally use jGrasp w/ the jdk's folder as a PATH when I'm trying to write something quick.




回答4:


You can try Jikes.



来源:https://stackoverflow.com/questions/624950/how-can-i-compile-java-code-in-windows-without-installing-the-whole-jdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!