Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 213
Leonardo Avatar asked Mar 09 '09 03:03

Leonardo


People also ask

Can we compile Java program without JDK?

JDK is created for Java programmers and contains tools required for Java programming, like javac for compiling Java source files to . class files. Without JDK, you can not create Java applications and programs.

Do I need to install Java and JDK separately?

The type of installation depends on your requirement and the platform that you choose to install. Download and install the Java Development Kit (JDK) for your platform. The JDK includes the JRE, so you do not have to download both separately.

Do you need JDK to run jar files?

To run a jar file you only need java.exe(windows). JDK is the development kit for Java and JRE is the runtime. JDK contains JRE.

Can I run Java without compiling?

Starting with Java SE 11 and for the first time in the programming language's history, you can execute a script containing Java code directly without compilation. The Java 11 source execution feature makes it possible to write scripts in Java and execute them directly from the *inx command line.


1 Answers

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.

like image 93
TofuBeer Avatar answered Sep 23 '22 10:09

TofuBeer