Skip to content
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

Add libraries to single file without a project #194

Closed
clankill3r opened this issue Dec 14, 2017 · 6 comments
Closed

Add libraries to single file without a project #194

clankill3r opened this issue Dec 14, 2017 · 6 comments
Assignees
Labels

Comments

@clankill3r
Copy link

clankill3r commented Dec 14, 2017

How can I provide a jar files to a single file that is not a project (like maven / eclipse /graddle)?
I tried:

 "args": "-classpath /Users/doekewartena/.m2/repository/org/processing/core/3.3.5"

and:

"args": "-classpath /Users/doekewartena/.m2/repository/org/processing/core/3.3.5/core-3.3.5.jar"

But that does not work.
Also I would prefer a way that intelliSense works, so that was heading the wrong way anyway.

I also tried a .classpath file in the root (this would be a nice way to have it working):

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="lib" path="/Users/doekewartena/.m2/repository/org/processing/core/3.3.5/core-3.3.5.jar"/>
</classpath>

Hope this is possible or would be possible in the future.
I'm really looking for a way where I don't have to use maven or eclipse or whatever to set up a simple java project.

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)

Environment
  • Operating System: OSX 10.12.6
  • JDK version: 1.8.0_144
  • Visual Studio Code version: VSCode 1.8.1
  • Java extension version: 0.2.0
  • Java Debugger extension version: 0.4.0
@akaroml
Copy link
Member

akaroml commented Mar 2, 2018

@clankill3r thanks for asking. @testforstephen please help the user on this issue.

@andxu
Copy link
Contributor

andxu commented Mar 5, 2018

For single file, the 3-party library is not supported now(the package name isn't supported also), we can vote for the feature like simple-project without .classpath and .project with predefined folder structure,

│   project.json/project.yaml --human readable configuration for project name, jdk version, etc
│
├───lib  -- folder for 3-party library
│       a.jar
│
└───src
    ├───main
    │   └───java
    │       └───com
    │           └───ms
    │               └───samples
    │                       App.java
    │
    └───test
        └───java
            └───com
                └───ms
                    └───samples
                            AppTest.java

@simahao
Copy link

simahao commented Mar 19, 2018

@clankill3r u can add config in launch.json like below:
"vmArgs": "-Djava.ext.dirs=/Users/doekewartena/.m2/repository/org/processing/core/3.3.5"

@andxu andxu added the voting Please vote on the issue, so that we will take priority to this issue. label Jun 20, 2018
@andxu andxu added the backlog label Nov 1, 2018
@andxu
Copy link
Contributor

andxu commented Nov 1, 2018

@simahao will add this feature at java-dependency in future, see it at https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency

@andxu andxu closed this as completed Nov 1, 2018
@andxu andxu added external and removed backlog feature request question voting Please vote on the issue, so that we will take priority to this issue. labels Nov 1, 2018
@Kirajav
Copy link

Kirajav commented Nov 8, 2018

@clankill3r u can add config in launch.json like below:
"vmArgs": "-Djava.ext.dirs=/Users/doekewartena/.m2/repository/org/processing/core/3.3.5"

I did it in the launch.json archive as mentioned before, but it doesn't really work for me. I'd really want to know "how can I provide a jar files to a single file that is not a project"?...
After a little research, i finally opted to make a quick-start maven project and add the respective dependency in the pom.xml file.

Well i just wanted to add a "mysql-driver.jar" archive to a single source code file (just for write some basic querys in jdbc using Visual Studio Code)

@Kirajav
Copy link

Kirajav commented Nov 8, 2018

@simahao will add this feature at java-dependency in future, see it at https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency

I also have this installed, but i don´t know how can i supposed to add the .jar library with this extension.

leonardost added a commit to leonardost/kifu-recorder-tests that referenced this issue May 30, 2019
I searched in a lot of places for how to import .jar files in VSCode,
and did not have much success. It seems VSCode prefers to use a project
build file (Maven, Gradle) to read dependencies. However, there's a new
feature where you put .jar files in a lib folder and it works.

redhat-developer/vscode-java#384
microsoft/vscode-java-debug#194
redhat-developer/vscode-java#501
eclipse-jdtls/eclipse.jdt.ls#927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants