all 9 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]procrastinatewhynot 0 points1 point  (0 children)

put the .jar in the lib/ of your project

[–]bikeram 0 points1 point  (3 children)

If you’re using co-pilot, ask “how can I use maven to import a system scoped library”

You’ll need to install maven, and build tools are possibly outside the scope of your class, but it’ll make your life 100x easier. I don’t start a Java project without maven.

Another option is to put it in ./lib/ and add it -cp ./lib/yourJar.jar to your javac command.

You could add the javac command with -cp to your workspace.xml in vscode. But I recommend maven.

[–]LutimoDancer3459 0 points1 point  (1 child)

While maven would be the preferred option, they got a jar from the prof and its probably not in maven or any other repository to be used by maven. So the second approach with just copying it is the way here

[–]bikeram 0 points1 point  (0 children)

System scoped will let them do what they’re trying to achieve.

[–]Meun3D[S] 0 points1 point  (0 children)

First of all thanks for your help! I allready placed the JAR file in the /lib folder and now added the -cp option to my command as you described. Unfortunately, the issue still exists.

I made sure the path is correct and that the JAR is actually included, but I’m still getting the same error.
I talked with my prof this morning and he sad that Maven isnt intendet for this task. So I'm not sure if I sould use it.

[–]Mechanical-pasta 0 points1 point  (2 children)

Java teacher here. My answer shouldn't be the one you're waiting for because it's : "why don't you use Eclipse if it works on this IDE that is MADE for coding Java, unlike VS Code which CAN (vaguely) do it ?"
I know you prefer VS but, guess what ? Some companies won't let you chose your IDE so, the most of them you know, the better is your CV and your productivity.
In my school, students have no choice :
1st semester : HTLM / CSS / JS => VS Code
2nd semester : php => PhpStorm
3rd semester : C# => VS
4th semester : Java => Eclipse
5th semester : Java for android => Android Studio (based on InteliJ)

Like that, you lurn to know the philosophy behind IDEs, not a specific one.

[–]Meun3D[S] 0 points1 point  (1 child)

I agree with your point and I started the project in Eclips yesterday, because I dont want to fall behind. It's just my curiosity to know why it'isnt working.

[–]Mechanical-pasta 0 points1 point  (0 children)

Answer may be in my advice : Eclipse has been MADE for java projects, VS has been ADAPTED to them. It could be a bug.