Im in my first week of college majoring in computer science. Can java source code be directly executed by JVM?
No, it can't.
The name "Java VM" is a bit of a misnomer. The JVM came about as a part of the Java platform, but it is actually independent from Java. Neither does the JVM execute Java (it executes its own language, which AFAIK doesn't have a name, but is usually called JVM bytecode, Java bytecode (another misnomer), or sometimes JVML) nor does Java require a JVM (you could just as well interpret Java directly, compile it to native machine code, compile it to ECMAScript, compile it to CLI CIL bytecode, etc.)
The Java platform consists of three components:
- The Java Programming Language
- The JVM
- The Libraries
They are all independent from one another. For example, you can use Java without the JVM and the Libraries, e.g. on Android. Android has a different bytecode format for a different VM, and it has different libraries. You can also use the JVM and Libraries without Java, e.g. from Scala, Clojure, ECMAScript, Ruby, Python, PHP, Fantom, Groovy, Frege, and so on.
No. Java VM cannot run (interpret) source code. Code must be compiled first, generating a byte-code file (.class) that can be interpreted and run by the JVMs. Java compilation doesn't generate native executables either.
Bytecode is an intermediate instruction set that is platform independant and so can be run in different OS's JVMs. Each JVM is compiled for its host OS which allows it to interpret the bytecode and compile it into native CPU instructions during runtime.
Short answer - no.
By way of an analogy:
Can you run your car on dinosaurs?
Of course not. Even if there were some around to try it with, they wouldn't fit (or want to get) in the tank.
Can you run your car on the bacteria, heat and pressured-treated remains of dinosaurs?
Yes. We call that petroleum.
You and I write source code.
A compiler converts that into byte code that we store in [jar] files. The Java RunTime can link-load those files into something that a computer can actually execute. There's no short cut.