ftomassetti / kanvas

A truly hackable editor: simple, lightweight, understandable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MainClass is not updated (was: How to run the editor?)

simon-gunacker opened this issue · comments

Hi,
I cloned your repo but I don't know how to run the editor.
regards, Simon

The project is a standalone application. If you want to run it from inside the IDE you just need to launch the Kanvas class in kanvas/kanvas-core/src/main/kotlin/me/tomassetti/kanvas/kanvas.kt

Does it help?

which IDE? This a gradle need-to-know thing?

I do not use any IDE. I am interested in how to run the project from commandline.

well, in the same way you would run any program on the JVM :)
It is a matter to run "java", specify the classpath and the main class to be run. Given it is tedious to figure out the good classpath you can let gradle do that for you.

This answer on S.O. could help: https://stackoverflow.com/questions/18195060/how-to-make-a-task-to-call-a-main-class

basically you want to create a task of type JavaExec and specify the name of your main class

Yeah, well - I have already tried that before opening this issue. I ran gradle build which responses with BUILD SUCCESSFUL. Then I ran gradle run saying

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_5t1ybp465gbwlt8xy2scrpe0d.run(/home/.../build.gradle:20)
:kanvas-core:generateGrammarSource UP-TO-DATE
:kanvas-core:compileKotlin UP-TO-DATE
:kanvas-core:compileJava UP-TO-DATE
:kanvas-core:copyMainKotlinClasses UP-TO-DATE
:kanvas-core:processResources UP-TO-DATE
:kanvas-core:classes UP-TO-DATE
:kanvas-core:run
Error: Could not find or load main class KanvasKt
:kanvas-core:run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kanvas-core:run'.
> Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.742 secs

Neither running the command with --info nor running it with --debug gives me any useful additional information (at least what I consider to be usful :-P)

The name of the class expected is the fully qualified name, I think you should set me.tomassetti.kanvas.KanvasKt instead of KanvasKt

Where do I have to set this? I just ran gradle run when the error appeared ...

Oh, I see, then it is a bug! I will fix it. You have just to change one line kanvas-core/build.gradle:

mainClassName = "me.tomassetti.kanvas.KanvasKt"

The bug is now fixed on master (that is why GitHub auto-closed the issue) but I will leave it open so @simon-gunacker can confirm it works for him

It works!!! Thanks a lot ;-)