Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 19850

Error: Could not find or load main class

$
0
0

I’m trying to follow this youtube api tutorial:

https://developers.google.com/youtube/v3/quickstart/java
I use java version “13.0.2” on a fresh lubuntu 19.10 distro

My folder structure is as follows

/src/main/build.gradle
/src/main/java/ApiExample.java

Following the tutorial I should be able to execute ApiExample as follows:

gradle -q run

However this exits with the following exception:
“Error: Could not find or load main class ApiExample
Caused by: java.lang.ClassNotFoundException: ApiExample”

My build.gradle is as follows:

apply plugin: ‘java’
apply plugin: ‘application’

mainClassName = ‘ApiExample’
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = ‘1.0’

repositories {
mavenCentral()
}

dependencies {
compile ‘com.google.api-client:google-api-client:1.23.0’
compile ‘com.google.oauth-client:google-oauth-client-jetty:1.23.0’
compile ‘com.google.apis:google-api-services-youtube:v3-rev222-1.25.0’
}

After what I’ve read the folder structure should be ok and the build file is copied from the tutorial. Any ideas what is missing?


Viewing all articles
Browse latest Browse all 19850

Trending Articles