0

There is a license to use Java which you must accept before installing. Why isn't there one for C or C++? If there is, where can it be found? I'm guessing it has to do with how Oracle owns Java, but in a sense can't you say whoever makes the C++ owns it?

  • C and C++ are two international standards maintained by ISO in cooperation with IETC. The copyrights are formally owned by the National Bodies. But that's the documents describing what C and C++ mean, not software. – MSalters May 5 '18 at 12:58
5

The reason for this is simple: You can’t install C or C++. C or C++ is just a programming language and C/C++ code compiles to machine code. Machine code can directly be executed by the processor (CPU) in your computer.

Java, however, is normally compiled to byte-code only a Java Virtual Machine can execute. And this Java virtual machine is what you get from Oracle and Oracle wants you to accept a license agreement.

You likely also have accepted some kind of license agreement when you began using or bought your computer. That’s the same you did for the Java Virtual Machine, but this time for your whole computer, which includes the processor that is responsible for executing the machine code.

Java in this context also refers to the Java libraries that ship alongside the JVM. While C or C++ also have standard libraries they are part of your operating system and you have agreed to a license covering them when you installed your operating system (or began using it).

  • A good explanation, but perhaps you could draw a comparison to help the less technologically- or linguistically-inclined? Maybe along the lines of "why do I have to pay for getting the typewriter but not for using English?" – Nij Jan 7 '17 at 12:12
  • 1
    You do need to install a C or C++ compiler, and while there are some technical differences with a VM, for the purpose of this question those differences are unimportant. C or C++ don't just work "magically". – Martin Tournoij Jan 7 '17 at 18:59
  • @Carpetsmoker Yes, for a compiler. But C and C++ are still just languages. And that’s what the question is about. And no, the difference is important here. Oracle licenses the "Java SE Platform" to you. That’s the VM. You don’t need to license anything to run C/C++ executables as long as you possess a compatible processor (which might come under a license as well, of course). – idmean Jan 7 '17 at 19:02
  • I disagree with his point too, you do need a compiler to run C/C++. But I guess when you install a compiler, it has it's own license agreement. – Toofast12 Jan 7 '17 at 22:35
  • @Toofast12 Of course you need a C/C++ compiler and as you said every compiler comes with a license. Here’s LLVM’s for instance: llvm.org/docs/DeveloperPolicy.html#license and here GCC’s gcc.gnu.org/onlinedocs/libstdc++/manual/license.html. If your question was actually about compilers, the answer is simple: Every reasonable compiler comes with a license. But your question sounded more like it was about the languages and not about compilers. Nobody "owns" C/C++ whereas Java is a registered trademark of Oracle. – idmean Jan 8 '17 at 10:58
2

The Java Licensing Agreement

The Binary Code Licensing Agreement for Java SE relates to your right to reproduce internally without modification their Java Virtual Machine (the thing that will run your compiled Java code). Among other things, it prohibits from making derivative works that "modify, or change the behavior of classes, interfaces, or subpackages that are in any way identified as 'java', 'javax', 'sun', 'oracle'". It also generally prohibits redistribution of the source code for the Java API.

C++ has similar protections

Analogous protections do exist relating to C++.

The runtime machine is protected

The design of your computer's processor is protected by patent and copyright (by Intel, or AMD, etc.), and you don't have permission to copy it. The reason you don't need an explicit license like you do for the Java Virtual Machine is because it is a physical thing that you legally possess, and no reproduction rights are implicated when you use it. Also, it would make no sense to call this part of C++ because it is used by every program that runs on your computer. But, it is protected, like the Java Virtual Machine is protected.

The compiler and standard libraries are licensed for your use

C++ requires a compiler to turn the code you write into an executable format. It also includes library code that implements a bunch of standard functionality that is available to the programs that you write. This compiler and library code are protected by copyright, and only available to you because of a license.

For example, a very popular implementation of C++ is GNU C++. Its C++ compiler (g++) and standard library implementation (libstd++) are distributed under the GNU Public License with a section 7 exception that allows "[proprietary] programs to use [...] the header files and runtime libraries...". Another C++ implementation, Clang/LLVM, is licensed under the BSD License. There are also many proprietary C++ implementations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.