Reputation: 5615
I'm using Netbeans to write Scala and Java.
Netbeans generated a .jar file for the Scala project. I tried importing that file in the Java project. But I couldn't import any class from that .jar file into my Java project.
I also tried importing scala-library.jar to the java project, and could import classes from that jar.
I want to write my library in Scala, then expose a small interface that only involves Java stuff, then write a Java wrapper so that people can use it as a Java package. Is that possible? How do I do it?
Thank you very much.
Upvotes: 8
Views: 2910
Reputation: 134270
There should be no problem in doing this.
jar
utility) that your .jar
file actually contains the relevant .class
files? (use jar tvf mylib.jar
to check).class
files exist in your jar
file, what is the runtime error you are seeing? Is it a NoClassDefFoundError
? If so, which class
cannot be found? How are you referring to the (Scala) class in your (Java) code?Upvotes: 8