LoginSignup
0
0

More than 1 year has passed since last update.

[備忘録]STSの起動ができなったときの対処法

Posted at

目的

読書記録のアプリケーションを作成しようとSTSで新規プロジェクトを立ち上げたが、アプリケーションの起動ができなかった。
すぐに解決ができずにいたため、その対処法を備忘録として残したい。

エラー文
[selection does not contain a main type]

結果

結論:HelloWorldApplication.javaを誤って消してしまっていた。

SpringBootで開発したアプリケーションを起動するクラスを削除していたため、起動ができなかった。

内容は以下の通り。

HelloWorldApplication.java
package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HelloWorldApplication {
    public static void main(String[] args) {
        SpringApplication.run(HelloWorldApplication.class, args);
    }
}

GitHubで削除前のデータは残っていたが、折角なので自分で作成したところ、うまく起動した。

感想

[HelloWorldApplication.java]を消したらアプリケーションが起動しないこと自体は覚えていたが、実際に消したときのエラーに遭遇してみて、すぐに[HelloWorldApplication.java]にたどり着けなかった。比較的簡単に解決したが、注意を払ってSTSの操作をしたい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0