-
Notifications
You must be signed in to change notification settings - Fork 132
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
Support to add Jar file or any other file/directory to classpath #94
Comments
@yaohaizh please help link this issue to vscode-java's new feature of adding Jar dependencies directly. |
I'm somewhat of a noob to this, but it seems quite odd to me that this is so difficult. Stackoverflow suggests a solution, but that doesn't work for me. I've tried both absolute and relative referencing of the jar file, putting the .classpath file in various locations, but it seems that vscode ignores it entirely. Any suggestions will be appreciated :) (I'd prefer a solution that works with the vanilla javac, e.g. without having to install maven) |
@Vigilans please take a look at this issue. Users are looking for a way of adding dependencies to their projects. |
It's so easy, anyway:
|
We are in the process of adding a UI entry for this. @Vigilans is on this. |
Start from Meanwhile, in order to improve the UX, we had this PR to let the users be able to config this setting from the Dependency Explorer, which will be available in the next version of Close this issue for now, but please feel free to let us know if you have any thoughts on this. Thanks. |
java.project.refe.. libs in mac os is not working. it is not a multiroot project, etc all java dependencies installed. thanks |
@husseinkohy What kind of project are you working on? Let's say, Can you see files like |
thanks guys for responding. it is an https://ant.apache.org/ivy/ivyde/ project. yes .classpath and .projects are there, what is not resolving in .classpath is ref's like this. <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=.... i could add the jar's individually as <classpathentry kind="lib" path="absolute path to a jar"....> but that would not be the ideal way. |
I see. Just as you said, some of the classpathentries needs to be resolved by the specific |
can you give a tutorial on how to set up through video, because I'm not entirely understanding it. |
@mp768 What kind of project are you using?
|
Confirmed: not working on macOS. Tried with a "naked" project. |
Hi, I'm trying too to use referencedLibraries to include libraries, but it doesn't work... no effect at all and I work on windows 10. I see also that using java dependency you can add external lib with the interface, (using the add button in the corner). I haven't the button, and folders are labeled with (Read-only). By now the only way I can add external lib is to typing directly the classpath file. WIth eclipse, no problem to add libs in the same project. Thk in advice for help |
@micheledellaciana1 I guess your project is an Eclipse project, which is so far not supported to manage libs in the dependency viewer. Here, what we supported is the |
ahhh Now I get it! Everything works fine! Many thanks! :)) |
你好,请问怎么引用本地的.class字节码文件夹呢?这里只能添加.jar包,并不能添加一个包含.class文件的包的目录噢! |
@gerrywp It's only supporting jar file right now, please feel free to create new feature requests here if you want more support |
What about adding it to projects that use maven? Those don't show a "Reference Libraries" section 😞 |
@HuskyNator we recommend to directly update the pom file, since that is the source of the truth of what the project build process. (otherwise, the build result in VS Code might be different from that in CI/CD). BTW, we do have the same request here. Please feel free to upvote it. If more and more people are requesting for it. We will consider to support this feature. |
Hello, i'm not sure i'm in the right place but i have been searching for days how to handle the eclipse project USER_LIBRARYS i have. My project is a Eclipse project with the .classpath and .project visible in vscode, my coworkers all use Eclipse and they have those two files in version control, so i can't delete or modify it (at least i can't delete entry in the .classpath). my classpath file looks like this : <?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding=".classpath|.gitattributes|.gitignore|.project|.settings/|branch.properties|build.xml|common-lib.xml/" kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JAVATOOLS18"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/COMMON_MASTER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/COMMON_DMPV2"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/COMMON_DMP"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JEEBOP_MSSPRO"/>
</classpath> and the Java project window show me all the entry like this : The JRE.CONTAINER is found and all the libs are ok for this one, but all the others are totaly empty ( should have about 80 libs in those ). As the project is "managed" the use of "java.project.referencedLibraries" doesn't work and i can't add the jar manually either since everything is readOnly in the "Configure Classpath" I'm sorry for digging this up but i'm really lost on this.. Is it just not supported and i have to use eclipse, do i need to try to find a way to remove the .classpath and .project of the version control so i can use "java.project.referencedLibraries" or is there a way i make it work in vscode? Or maybe a way to ignore those .classpath and .project so that it is unmanaged and i import all the libs in settings.json ? |
@kartercs AFAIK, USER_LIBRARY is not supported.
Should work in this way. If it does not, please let us know. |
Thanks for your answer @jdneo ! I finnaly made it work by changing names of .classpath and .project files, so that it's unmanaged, but then vscode told me it was not a java project anymore. "java.project.sourcePaths": ["."], Then i just imported all the libraries in the settings.json and it all worked ! The only "problem" i have between this and eclipse is that the order in which you declare your imports doesn't seem to have an impact on which lib is used, in the .classpath the first libs are always used over the other one if there is a conflct. Thanks again for all of this, using eclipse was a nightmare for me ! |
@kartercs So far, the unmanaged folder does not have the concept of import order for those referenced libraries. Please file a feature request for that :) |
The extension does not support addition external jar file to the classpath. The only way is to manually add it to .classpath file. Please refer to https://stackoverflow.com/questions/50232557/visual-studio-code-java-extension-howto-add-jar-to-classpath/54535301#54535301
The text was updated successfully, but these errors were encountered: