0

I have developed a Java app on my Windows laptop using VS Code. The app was always intended to run on a Raspberry Pi400, and I did not realise that VS Code could also run on the Pi until the development was almost complete. It would of course be much more effective to finish and debug the app on the actual target machine. So I installed Code on the Pi, added the Java extensions, and copied the project folder across. I edited the settings.json file in the .vscode subfolder of the project to correctly point to the referenced libraries the app uses in their new location on the Pi.

I thought I should then be able simply to open the folder in VS Code and it would see it all as a Java project. It sort of does, but sort of doesn't. Nothing happens until I click on one of the java source files, but when I do, the following things happen:

The JAVA PROJECTS pane appears in the left sidebar under the EXPLORER pane. A blue underline starts repeatedly marching across the pane under the words JAVA PROJECTS. A spinning icon appears at the right end of the blue status bar at the bottom of the screen.

This is all expected, and is what happens on the Windows laptop when I open the folder. But the difference is that on the Pi it never completes the process. The JAVA PROJECTS pane never gets populated, and the spinning icon at the bottom never stops spinning. So I simply cannot work with the project on the Pi, which was the objective of all this. It seems likely that something VS Code needs is missing, but I cannot see what. If anyone has any ideas it would be very good to sort this out. I should point out that this is not a Maven project - it was created as a "no build tools" project, which worked fine on Windows.

EDIT: I've just found that this is nothing to do with my moved project. If I try to create a new Java project on the Pi, starting from nothing, the exact same thing happens. So if it is something missing, it is missing from the VS Code installation, not anywhere in my project. I thought it might be that I had not configured the Java runtime yet, but I cannot do that until I have a project.

  • You don't need to write the code on the target platform. Just write your code anywhere, compile it into a `.jar` and run that on the pi with the appropriate JRE – Phil Jan 04 '22 at 22:34
  • Yes I get that, but it would be nice to be able to run it in debug mode on the target platform. I was hoping that VS Code would enable that. – user2892869 Jan 05 '22 at 00:35
  • You might find this interesting ~ [How do attach to a remote Java debugger using Visual Studio Code](https://stackoverflow.com/q/44372595/283366) – Phil Jan 05 '22 at 00:37
  • Wow thanks. Will definitely investigate that. – user2892869 Jan 06 '22 at 05:58

0 Answers0