-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will not Run. Stuck Importing projects #1148
Comments
The output channel says the extension got closed. Could you try to see the log files to get more info? F1 -> Java: Open All Log Files |
@Carsonc8 Thanks for sharing the logs. Are you running VS Code on Mac M1 chip? The logs show that Java extension is using an embedded 17.0.2-macosx-x86_64 JRE to start Java extension itself, that won't work for arm64 architecture. The workaround is to add the user setting |
Yes, I am using a Mac M1 Chip. Also, do you mind explaining how to add the user setting java.jdt.ls.java.home. I am not too familiar with VS Code. |
Here is how to change VS Code user setting. jdtlshome.mp4 |
I have the same problem and downgrading the Versione: 1.66.2 (system setup) |
@jakopo87 The original issue is that Mac M1 used a wrong embedded JRE to launch Java extension. Your issue is different with the issue. Could you pls share the logs in the following places?
|
I think i successfully did this part but it's not working? I opened another folder in vscode which used to work earlier, and it still works |
I have this same issue. I cannot run/debug any java files. I get the identical "Debug: Importing Projects" dialog that just spins forever. I have no terminal output and no output under 'check details'. This was working earlier today. I was getting project errors but the code would still compile and run. I restarted VSCode to reload some updates and then it started doing this. I have tried uninstalling all the java extensions and reinstalling them to no avail. Currently only have these java extensions installed, and the problem persists:
VScode info:Version: 1.66.2 Also of note I don't have the "Run | Debug" buttons that typically appear above the main class if the code is good. (I have checked the files manually with |
client.log.2022-04-20.log |
Oddly, in my case this seems to only affect files in the root of my java working directory. If I create a subfolder, add the java files there, and open that subfolder in VSCode, then the run/debug function works as expected. I am not using projects, and am opening just the folder in all cases. It does not seem to matter if there is a .vscode/launch.json file or not. |
@jakopo87 The root cause for your issue is that your VS Code user setting I will create an issue at https://github.com/redhat-developer/vscode-java/issues to report the errors more explicitly. |
@testforstephen Changing the url fixed the issue for me, now it works on the latest version of the extension. |
@throwthrowaway Would you mind sharing your folder structure to us? Also it would help us if you could share the logs at these places, thanks.
@chris-hunter206 Would you mind sharing a minimum sample folders to help us reproduce the issue? thanks. |
I verified the problem still exists with that one folder. Here is the layout of the folder that has these issues, when it is the vscode root:
I can open vscode using any of these subdirectories as the root fine, and everything works. it's only when I open this folder does the run function break. Also CPU usage again spiked when I had the broken root folder open in vscode. Previously this bogged the system down after a time into a completely unusable state requiring a reboot, so I didn't leave it open for long. I tried to reproduce the issue using a minimal folder setup like this:
Everything worked fine. I then copied over the Assignment1 folder and while it didn't fail in the same exact way, it did start giving me project errors about files in Assignment1/. (And this was while trying to run, for example, Template.java which is totally unrelated and has no connection to that folder). Errors are in the attached screenshot. Of note, this were the same errors I saw initially on the day I started experiencing the problem with my root folder, that eventually deteriorated into not being able to run any java files from that folder. The Assignment1 folder doesn't have anything special in it except the java files for that assignment, and a .vscode/launch.json file. I have not intentionally created any projects, but I suspect the editor may have added one initially when I created Assignment1, and is storing some data about that project somewhere that could possibly be corrupted. I don't offhand know where that project info might be stored, as it doesn't appear to be in the working directory anywhere. I have some logs I captured initially if you would like them. |
@chris-hunter206 When you simply open a standalone folder with Java files, and don't use any project system to manage source file structure, VS Code Java will try to understand your source directories. But sometimes it may fail to guess your source directories correctly. In your last screenshot, it's a typical case where Java tools fails to recognize your source directories, and it takes the folder "Assignment1" as a package name by mistake. I know you just want to take "Assignment1" as a normal folder instead Java package. So a suggested solution is to explicitly tell Java extension how your source directories are organized. You can add a setting
|
I got the same issue with it being stuck importing projects forever, and none of the other solutions seemed to work. Here are my log files: |
@GamesDoneWr0ng Thank you for providing logs. The log shows your workspace state file is corrupted and failed to restore it, that's a duplicated issue with microsoft/vscode-java-pack#954 (comment).
You could click "F1 -> Java: Clean Java Language Server Workspace" to reset the cache. |
@testforstephen Thanks that seemed to work. |
I am not using workspaces, only opening a folder and working on the files within. I did not have any |
I saw your note about the workspace state file being an issue for another person, so I started looking through my logs and located the workspace data folder ( After that, I loaded the root folder again and it seems to have fixed the issue. Initially I was getting a number of the same "Declared package does not match expected package" errors, but after selecting "Fix" and "Clear workspace cache", I am now able to successfully run java programs from that root folder. When I open various subfolders, I get prompted to add the folder to the java source path, and several files still seem to generate package errors, though the program will still execute if you select "Proceed" Of note, when I removed the workspace data folder that pointed to the problematic root folder, it got recreated with the same numeric hash, but no Another thing: The CPU spike might be a red herring for this issue. It seems to happen every time I open a new folder in vscode, and specifically is traced to a process consuming up to 100% CPU after a couple of minutes: |
@chris-hunter206 thank you for providing the details. "Fix" and "Clear workspace cache" are doing the same thing as the step "F1 -> Java: Clean Java Language Server Workspace", which will remove the old cache at Regarding the CPU spike issue, the processes you listed are from VS Code core. You may take a look at how to profiling VS Code process https://github.com/microsoft/vscode/wiki/Performance-Issues#profiling-the-renderer-process. |
Hey Carson, did you get this fixed? & do you remember how you fixed it? |
Hi there, unfortunately, I did not fix it but, if you look at the beginning of this thread you can see the conversation between testforstephen and I. He gave me a solution to the problem that was occurring (not sure if you are encountering the same problem.) I was still unable to fix the problem though and with finals coming up, I had to focus on other things. I would recommend going over the steps testforstephen gave me and if that still does not work you should try creating a thread with your problem and hopefully someone will be able to assist you. |
Thanks for replying. I wasn't able to fix it. I just discarded Lombok from my application and rewired everything and it worked for me. Thank you |
m1 chip too settins.json "java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/Users/admin/.sdkman/candidates/java/11.0.17-zulu",
},
{
"name": "JavaSE-1.8",
"path": "/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home",
"default": true
},
{
"name": "JavaSE-16",
"path": "/Users/admin/.sdkman/candidates/java/16.0.1.j9-adpt"
}
],
"java.jdt.ls.java.home": "/Users/admin/.sdkman/candidates/java/18.0.1-zulu",
|
Hi everyone, I just wanted to share my experience with the issue being discussed here. I was also facing the same problem while using Visual Studio on Github codespaces. Whenever I tried running a simple java program in the workspace, the "Run: Importing projects" would never stop and kept on loading endlessly. I looked at multiple logs, but couldn't really figure out what was causing the problem. However, while going through this thread, I came across the suggestion to downgrade the version of Language Support for Java(TM) by Red Hat to v1.14.0 from v1.15.0 (which was released 4 days back). After reloading the workspace and rerunning the java code, everything worked flawlessly. All the java projects in my workspace were identified, and I was able to run/debug my java programs through visual code. It took me 3-4 days to figure out this issue, and I was wondering if there is an easy way to prevent it from happening in the first place. If anyone has any inputs or suggestions, they are more than welcome. Thanks for your time! |
@rahulbagai, could you share a sample project to help us to reproduce the issue? |
Hi guys, I'm in the same situation...importing a spring boot project, stuck in the building process. I switched for old, release and pre-release versions of Language Support for Java(TM) by Red Hat, clean the workspace, defined the jdk in |
@testforstephen I started with an empty repository, and create one simple Java Hello World program, and then try to run it. I even tried created a sample maven archetype, and that would also have the same issue. Please make sure you have the latest version of Java Extension Pack, and Language Support for Java(TM) by Red Hat to v1.15.0. Let me know if you are still not able to reproduce the issue. |
Same problem here, but I just run my file in terminal and it works |
file:///c%3A/Users/antim/Searches/Imágenes/captura de pantalla.pnghttps://open.spotify.com/track/3jXptpf8Z3aU9O1Bj6YCl0?go=1&sp_cid=fdeb0b24-8855-4637-bd13-3d659deef1e5&utm_source=embed_player_p&utm_medium=desktop |
Issue Type: Bug
Not quite sure. Just ran my program and now stuck trying to import projects. Left it running for over 10 minutes and still the same thing.
Extension version: 0.40.0
VS Code version: Code 1.66.0 (Universal) (e18005f0f1b33c29e81d732535d8c0e47cafb0b5, 2022-03-30T05:50:04.419Z)
OS version: Darwin arm64 21.4.0
Restricted Mode: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
A/B Experiments
.
The text was updated successfully, but these errors were encountered: