Code artifacts are files produced by development tools from source files, dependencies, and build rules.

Learning Question

After a source file is interpreted by a compiler or build tool, what kind of file can it become?

A code artifact is a file produced by development tools from source files and dependencies, such as an object file, class file, JAR, executable, or other deployable representation.

The central distinction is:

Building creates more files. It is not the same thing as running the program.

Source Files As Inputs

Source files are input artifacts.

They usually contain text interpreted through language rules.

Examples include:

  • .java
  • .c
  • .js
  • .py
  • .md

Build tools and compilers read those files, combine them with dependencies and configuration, and may produce output artifacts.

The source file remains a file.

The output artifact is also a file.

The difference is the intended reader.

Output Artifacts

Output artifacts can take many forms.

Examples include:

  • .class files
  • .o or .obj object files
  • native executable files
  • JAR files
  • bundled JavaScript files
  • generated source files
  • resource bundles
  • debug-symbol files
  • container or deployment packages

These artifacts may contain:

  • bytecode
  • machine-code fragments
  • metadata
  • resources
  • symbol information
  • debug information
  • manifests
  • references to other libraries

They are not all meant for the same reader.

Different Artifacts Target Different Readers

A .class file targets a JVM.

An object file targets a linker and toolchain.

A native executable targets an operating-system loader and CPU execution environment.

A JAR file commonly packages class files and resources for Java tooling.

The key question is not only:

What file extension does this artifact have?

The better question is:

Which later layer is meant to read this artifact?

Class File Versus JAR

A Java .class file is a JVM-defined binary format containing class metadata and bytecode.

A JAR file is usually a ZIP-based package that can contain many class files, resources, and metadata.

The JAR is a container.

The class file is a JVM-loadable class representation inside or outside that container.

Running a Java application may involve Java tooling opening a JAR, finding classes and metadata, starting a JVM process, and loading class files.

That process is not the same thing as the JAR being a native executable file for the operating system.

For deeper Java details, see From Java Source Code to Class Files.

Object File Versus Executable File

An object file may contain compiled machine-code fragments and metadata.

But it is often not a complete program file.

It may still contain unresolved symbols or relocation information that a linker must process.

An executable file is a linked artifact in a format that the operating system can load as a program target.

For deeper C details, see From Source Code to Executable File.

Building Versus Running

Building creates artifacts.

Running creates behavior.

The distinction matters because a successful build proves only that the tools produced artifacts under their rules.

It does not prove:

  • the program has started
  • runtime dependencies are available
  • the JVM has loaded classes
  • the operating system has created a process
  • the CPU has executed the program’s instructions
  • the program will behave correctly

Build output is still stored representation.

Runtime behavior begins only when the appropriate runtime or operating-system layer uses those artifacts.

Optional Small Experiment

This experiment assumes a Unix-like shell such as WSL Ubuntu and a JDK with javac available.

Create a Java source file and compile it:

cat > Hello.java <<'EOF'
public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello");
    }
}
EOF
 
javac Hello.java
ls -l Hello.java Hello.class
xxd -l 8 Hello.class

What To Observe

Hello.java is source text.

Hello.class is a generated binary code artifact.

The first bytes of the class file should include:

ca fe ba be

That marker shows that Hello.class is not Java source text.

It is also not native machine code for direct CPU execution.

It is meant for the JVM.

What This Proves

Compilation produced another file.

The new file has a different intended reader.

The build step did not by itself run the Java program.

It created a JVM-facing artifact that can be loaded and executed later by a JVM runtime.

What Build Artifacts Do Not Explain

This chapter does not teach a full Java, C, linker, build-system, package, or deployment model.

It preserves the representation boundary:

Code artifacts are files produced for later interpretation by toolchains, runtimes, loaders, or execution environments.

Code Artifact Rule To Carry Forward

Separate these layers:

  • source file: text input to language tools
  • compiler or build tool: reader and transformer
  • code artifact: generated file representation
  • linker, runtime, loader, JVM, or CPU: later reader or execution layer
  • running process: runtime instance, not merely a generated file

When inspecting a build output, ask:

Which tool produced this file, and which later layer is supposed to read it?

Artifacts As Outputs For Later Readers

Source files become code artifacts when development tools translate, package, or generate files from them.

Those artifacts are still files made of bytes.

They become useful only when the correct next layer reads them: a linker, JVM, loader, runtime, CPU, or another build tool.