Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non programmatic use, Failed to load Main-Class #66

Open
oschrenk opened this issue Jul 26, 2013 · 4 comments
Open

Non programmatic use, Failed to load Main-Class #66

oschrenk opened this issue Jul 26, 2013 · 4 comments

Comments

@oschrenk
Copy link

Is it possible the produce scala files in a non programmatic way. I tried the jar

wget -O scalabuff-compiler_2.10-1.3.3.jar http://search.maven.org/remotecontent?filepath=net/sandrogrzicic/scalabuff-compiler_2.10/1.3.3/scalabuff-compiler_2.10-1.3.3.jar
    java -jar scalabuff-compiler_2.10-1.3.3.jar

but get

Failed to load Main-Class manifest attribute from
    scalabuff-compiler_2.10-1.3.3.jar

And indeed there is no such definition. Is there a way to do this?

@oschrenk
Copy link
Author

The MANIFEST.MF in the jar from Maven Central

Manifest-Version: 1.0
Bnd-LastModified: 1374176813268
Bundle-ManifestVersion: 2
Bundle-Name: net.sandrogrzicic.scalabuff.compiler
Bundle-SymbolicName: net.sandrogrzicic.scalabuff.compiler
Bundle-Version: 1.3.3
Created-By: 1.7.0_25 (Oracle Corporation)
Import-Package: scala;version="[2.10,3)",scala.collection;version="[2.10
 ,3)",scala.collection.generic;version="[2.10,3)",scala.collection.immut
 able;version="[2.10,3)",scala.collection.mutable;version="[2.10,3)",sca
 la.collection.parallel;version="[2.10,3)",scala.reflect;version="[2.10,
 3)",scala.runtime;version="[2.10,3)",scala.util;version="[2.10,3)",scal
 a.util.matching;version="[2.10,3)",scala.util.parsing.combinator;versio
 n="[2.10,3)",scala.util.parsing.input;version="[2.10,3)"
Include-Resource: E:\_\Scala\ScalaBuff\scalabuff-compiler\src\main\resou
 rces,E:\_\Scala\ScalaBuff\scalabuff-compiler\target\scala-2.10\resource
 _managed\main
Private-Package: net.sandrogrzicic.scalabuff.compiler
Tool: Bnd-1.50.0

is very much different, from the one you get when executing sbt package

Manifest-Version: 1.0
Implementation-Vendor: net.sandrogrzicic
Implementation-Title: scalabuff-compiler
Implementation-Version: 1.3.3
Implementation-Vendor-Id: net.sandrogrzicic
Specification-Vendor: net.sandrogrzicic
Specification-Title: scalabuff-compiler
Specification-Version: 1.3.3
Main-Class: net.sandrogrzicic.scalabuff.compiler.ScalaBuff

Latter also doesn't work. java -jar scalabuff-compiler/target/scala-2.10/scalabuff-compiler_2.10-1.3.3.jar produces

Exception in thread "main" java.lang.NoClassDefFoundError: scala/Function1
    at net.sandrogrzicic.scalabuff.compiler.ScalaBuff.main(ScalaBuff.scala)
Caused by: java.lang.ClassNotFoundException: scala.Function1
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 1 more

@oschrenk
Copy link
Author

So I found the sbt way of compiling the .proto files. I documented my findings in the wiki on the usage examples page. Honestly I would like to have this information in the README.

Still it would be nice to having a working solution that works with a single jar.

@SandroGrzicic
Copy link
Owner

You need to start ScalaBuff with the scala command or at least include the necessary Scala libaries.

As for the missing main-class, it might be due to the SBT-OSGi plugin that I'm using.

@oschrenk
Copy link
Author

I was under the assumption that it produced a Java executable jar. Understandably it doesn't. So this is the way:

$ sbt package
$ scala scalabuff-compiler/target/scala-2.10/scalabuff-compiler_2.10-1.3.3.jar 

There is still the issue that the published jar, doesn't contain the definition of the Main-Class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants