In Scala; should I use the App trait?

The problem with the Application trait is actually described in its documentation: (1) Threaded code that references the object will block until static initialization is complete. However, because the entire execution of an object extending Application takes place during static initialization, concurrent code will always deadlock if it must synchronize with the enclosing object. This … Read more

Get name of executable jar from within main() method [duplicate]

Here you go: new java.io.File(SomeClassInYourJar.class.getProtectionDomain() .getCodeSource() .getLocation() .getPath()) .getName() Edit: I saw your comment about getSourceCode API. Well, this is probably the best you can do in Java. About getCodeSource() returning null, I think it mainly happens on classes in java.lang.* and other special classes for which the source location is “hidden”. Should work for … Read more

Main method in Scala

To answer your question, have a look on the following : I made a scala class, compiled and decompiled it, and what I got is interesting. class MyScalaClass{ def main(args: Array[String]): Unit = { println(“Hello from main of class”) } } Compiled from “MyScalaClass.scala” public class MyScalaClass { public void main(java.lang.String[]); public MyScalaClass(); } So … Read more

crt1.o: In function `_start’: – undefined reference to `main’ in Linux

Try adding -nostartfiles to your linker options, i.e. $(LINK) -nostartfiles -g … From the gcc documentation: -nostartfiles Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used. This causes crt1.o not to be linked (it’s normally linked by default) – normally only … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)