I am working on a school project where I am writing a Scala class to be part of a Java project, using IntelliJ IDEA on MacOS. Here is what the folder structure looks like:
TopLevelFolderName
.idea
.settings
bin
classes
artifacts
TopLevelFolderName.jar
src
dir1
JavaClass.java
Main.java
dir2
ScalaClass.scala
META-INF
.classpath
.project
TopLevelFolderName.iml
I can build and run the program to run the main
function in the Main
class, using the Scala code in ScalaClass
.
However, when I set up the project structure to build a JAR in the classes/artifacts
folder, the JAR file doesn't work when I go to the menu and click Run TopLevelFolderName.jar
. I get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Tuple2
Does anyone know how to set up my project such that Scala standard dependencies get included and are made accessible to the JAR file? This is my first time using IntelliJ IDEA.
Thank you, and please let me know if I can provide more information.