Reputation: 233
I can't run or debug Groovy scripts in IntelliJ. I'm getting the error: Error: Could not find or load main class org.codehaus.groovy.tools.GroovyStarter
. Running scripts from cmd works propertly (I'm using groovyc and groovy command).
import org.apache.pdfbox.pdmodel.PDDocument
import org.fit.pdfdom.PDFDomTree
import org.w3c.dom.Document
// load the PDF file using PDFBox
PDDocument pdf = PDDocument.load(new java.io.File("file.pdf"))
// create the DOM parser
PDFDomTree parser = new PDFDomTree()
// parse the file and get the DOM Document
Document dom = parser.createDOM(pdf)
Upvotes: 5
Views: 13290
Reputation: 11
I had had the same problem until I did the next:
After all, I can run/debug my scripts from IDEA
Upvotes: 1
Reputation: 233
I missed https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all/2.4.12 depedency in my pom.xml file. Bug is resolved. Thanks All for your hints :)
Upvotes: 4
Reputation: 1685
Create Run Configuration
(⌘N), and set the Module
to the Module that contains all of your dependencies.
Upvotes: 3
Reputation: 2255
Try to create you script not as Groovy class. Use this way:
Ctrl + Shift + A -> Groovy Script -> Set script name
Upvotes: 0