Created
April 18, 2013 23:42
-
-
Save 89465127/5417064 to your computer and use it in GitHub Desktop.
How to compile and run HelloWorld programs in java and scala through the command line terminal, with jar dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Compile HelloWorld, with jars in this directory | |
javac -cp ".:*" HelloWorld.java | |
scalac -cp ".:*" HelloWorld.scala | |
#Run | |
java -cp ".:*" HelloWorld | |
scala -cp ".:*" HelloWorld | |
# HelloWorld.java | |
class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("Hello, Java World!"); // Display the string. | |
} | |
} | |
# HelloWorld.scala | |
object HelloWorld { | |
def main(args: Array[String]) { | |
println("Hello, Scala World!") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment