How to run scala bytecode on jvm?

How to execute compiled scala code on jvm?

When trying to execute the following command:

java -cp scala-library.jar -cp bin com.mcmc5.Main

I get the following error: Exception in thread "main" java.lang.NoSuchMethodError: main

In scala code, I have a Main object and it has the main function defined there. It works, if I do scala -cp bin com.mcmc5.Main , it works great.

Is there something I am missing?

Thank thejinx0r

Edit1: Here is my code: The reason I want it to run on the JVM is because the server on which I want to actually execute the bytecode does not have scala installed. This is what essentially has my core (it has certain values ​​and variables defined before it, but essentially:


package com.mcmc5
import java.text.{DateFormat, NumberFormat, DecimalFormat, SimpleDateFormat}
import java.util.{Date}
 object Main {  def main( args: Array[String]) = {
        println(numberOfOutputStructures)
        var structureSolver = new MC(20);
        structureSolver.start()
    }
} 

But I was still trying to use java -cp scala-library.jar:bin com.mcmc5.Main, and I still get the same error.

2 .

, .

,  ( ) , java object Main extends Application . extends Application main, . , , scala . scala 2.9, rc2, ? rc1?

+5
1

Windows,

java -cp scala-library.jar;bin com.mcmc5.Main

java -cp scala-library.jar:bin com.mcmc5.Main

"-cp". , , com.mcmc5.Main scalac.

+10

All Articles