Commit 24439d3b authored by Etienne Toussaint's avatar Etienne Toussaint

Merge branch 'ScalaJava_Project' into 'master'

Scala java project



See merge request !1
parents 6c4f4351 be3d47fe
target
*.class
build
.classpath
.project
.settings
org.scala-ide.sdt.core/META-INF/MANIFEST.MF
org.scala-ide.sdt.update-site/site.xml
# Makefile author: Joseph Anderson <jtanderson@ratiocaeli.com>
# This is where you specify the necessary source files
# Program packages and files
# - The packages should be the path inside your src directory. eg: package1 package2/package3
PACKAGES = core graphics map_generation network user_interface
# Java compiler
JAVAC = javac
JVM = 1.8
# Directory for compiled binaries
# - trailing slash is important!
BIN = bin/
# Directory of source files
# - trailing slash is important!
SRC = src/
# Java compiler flags
# JAVAFLAGS = -g -cp $(SRC)
JAVAFLAGS = -g -d $(BIN) -cp $(SRC) -target $(JVM)
# Creating a .class file
COMPILE = $(JAVAC) $(JAVAFLAGS)
EMPTY =
JAVA_FILES = $(subst $(SRC), $(EMPTY), $(wildcard $(SRC)*.java))
ifdef PACKAGES
PACKAGEDIRS = $(addprefix $(SRC), $(PACKAGES))
PACKAGEFILES = $(subst $(SRC), $(EMPTY), $(foreach DIR, $(PACKAGEDIRS), $(wildcard $(DIR)/*.java)))
ALL_FILES = $(PACKAGEFILES) $(JAVA_FILES)
else
#ALL_FILES = $(wildcard $(SRC).java)
ALL_FILES = $(JAVA_FILES)
endif
# One of these should be the "main" class listed in Runfile
CLASS_FILES = $(subst $(SRC), $(BIN), $(ALL_FILES:.java=.class))
# CLASS_FILES = $(ALL_FILES:.java=.class)
# The first target is the one that is executed when you invoke
# "make".
all : $(addprefix $(BIN), $(CLASS_FILES))
# The line describing the action starts with <TAB>
$(BIN)%.class : $(SRC)%.java
$(COMPILE) $<
clean :
rm -rf $(BIN)*
SBT:
- To install sbt: http://www.scala-sbt.org/0.13/tutorial/Setup.html
- To use sbt, place yourself at the root of the project (where there is the build.sbt file) and enter "sbt" in the command line. It will start sbt. Then enter "compile" to compile the whole project, or "run" to compile the whole project and execute it.
name := "the_dungeon_project"
version := "1.0"
scalaVersion := "2.11.7"
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
//sbt will check that library and keep it around so we can use it (it's a library for building concurrent message-driven applications on the jvm
libraryDependencies += "com.typesafe.akka" % "akka-actor" % "2.0.2"
scalacOptions += "-deprecation"
import core.*;
import graphics.*;
//<Just a try>
import scalaHello_package.*;
//</Just a try>
class Main {
public static void main (String[] args){
System.out.println("Hello World");
Core c = new Core();
//<Just a try>
ScalaHello.sayHelloToJava();
//</Just a try>
}
}
import core.*;
import graphics.*;
//<Just a try>
import scalaHello_package.*;
//</Just a try>
class Main {
public static void main (String[] args){
System.out.println("Hello World");
Core c = new Core();
//<Just a try>
ScalaHello.sayHelloToJava()
//</Just a try>
}
}
package scalaHello_package
object ScalaHello {
def sayHelloToJava() = {
println("Hello JAVA, my name is SCALA!")
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment