0

So I am completely out of ideas here. I am developing within an Ubuntu 20.04.4 Docker container on a windows machine. The project is maintained in Gitlab, and when developing within my Windows env, ie not inside the container, the project is identified correctly. For some reason, inside the container, the project will not be identified as a java project. I have the java extension pack, tried new containers, deleted and re-installed VScode, deleted and reinstalled Docker, cleared the app/temp data for each project, reset/cleared the java server, tried various JDK/JRE within the container, and quite a few other things I am likely forgetting. The issue is clearly something within the container env, but I just have no idea what it could be? Looking for ideas on where to look/what to try.

A small example of the problem:

public class QuickStartApplication{
    public static void main(String[] args) throws Exception {
        new QuickStartApplication().run();
    }

For the above, I would get the error stating "Error: Main method not found in the file, please define the main method as: public static void main(String[] args)"

I have tried the solutions from similar problems here: Why intelij does not recognize java project?

and here: Importing java project in visual studio code and getting build path error. unbound classpath container: JRE System library jdk-8.0.202.08

neither of which resolves the issue.

Connor
  • 53
  • 1
  • 7
  • typo has been fixed; not relevant to issue. – Connor Nov 29 '22 at 18:31
  • Also, why are you developing inside the container? Shouldn't you be developing on a VM/Local machien and executing stuff inside the container? – whiplash Nov 29 '22 at 18:32
  • What does "Developing inside a container" mean? Are you using something like Remote Containers Extension or similar? – Christoph Dahlen Nov 29 '22 at 19:56
  • Yes using devcontainers extensions – Connor Nov 29 '22 at 21:33
  • @whiplash The project has quite a lot of dependencies.... I guess it is easier to package everything up into a container and provide it in a standardized env for development – Connor Nov 29 '22 at 21:36
  • @Connor Right. I still am not sure if this is the right way to do this. You always develop code in your local machine or a VM. The container is supposed to be a light weight thing that just executes your piece of code. My suggestion is to write code in your windows machine and only execute the code in the container. Don't develop inside the container. – whiplash Nov 30 '22 at 00:11
  • Can you show your error interface? Did you save the file? – JialeDu Nov 30 '22 at 05:25

0 Answers0