question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow support of standalone java files in subfolders

See original GitHub issue

I have a use case a bit particular for VS Code java related VS Code Camel K. Apache Camel K is using standalone java files. VS Code Camel K is downloading the required dependencies and providing them through the java.referencedLibraries setting of VS Code Java. it works great for standalone Java files which are at the root of the workspace. The Apache Camel K examples folders (here and here) is providing a lot of examples, including some that are contained in a specific subfolder. VS Code Java is reporting error complaining that The declared package "" does not match the expected package "<thefoldername>"

would it be possible to import each subfolder as an invisible project?

Environment
  • Operating System:
  • JDK version:
  • Visual Studio Code version:
  • Java extension version:
Steps To Reproduce
  1. install VS Code Camel K extension
  2. install Language support for java
  3. clone https://github.com/apache/camel-k
  4. open examples folder in VS Code instance
  5. open one of the java file –> there is error The declared package "" does not match the expected package "<thefoldername>" –> note that there are also errors due to missing dependencies which are a problem at VS code Camel K and not at VS Code Java at all

[Please attach a sample project reproducing the error] Please attach logs

Current Result
Expected Result
Additional Informations

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jdneocommented, May 27, 2020

@jdneo Yes, it does. What you need is to manually mark each subfolder as a source root. You can achieve that through File Explorer context menu “Add Folder to Java Source Path”/“Remove Folder from Java Source Path”.

@apupier Would you mind have a try and let us know if this solves your problem?

0reactions
jdneocommented, Jul 5, 2021

The command Java: Configure Classpath should somehow mitigate the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is subfolders allowed under "deployments&q...
Hi,. Is it possible to deploy any deployments (WAR, RAR, EAR) files inside a sub-folder in the "deployments" subdirectory. I tried RAR file, ......
Read more >
Compiling java files in all subfolders? [duplicate]
Create a batch file: for /r %%a in (.) do (javac %%a\*.java) ...then execute it in the top-level source folder. On Linux... javac...
Read more >
How to run java class file which is in different directory?
Here, We have one utility class that is A. Step 2 (Compile utility class): Open terminal at proj1 location and execute following commands....
Read more >
If you have a .Java file in a folder by itself, can this be run or ...
Files [] files=new File("/path/to/the/directory"); · FilenameFilter xmlFilter=new FilenameFilter() { @Override public boolean accept(File dir, String name) { ...
Read more >
Java Modules
Packing a Java Module as a Standalone Application ... A Java module is packaged as a modular JAR file. A Java module can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found