Thread: How to add libraries to classpath?

Results 1 to 8 of 8
  1. #1 How to add libraries to classpath? 
    Registered Member

    Join Date
    Oct 2014
    Posts
    192
    Thanks given
    31
    Thanks received
    15
    Rep Power
    81
    Hi

    I actually cant figure out how to add libraries to the classpath,
    I thought i could just do this:

    Code:
    javac -d bin -cp ./deps/*.jar @srcs.txt
    But when i do, i get a bunch of "package does not exist" and "cannot find symbol" exceptions from the libraries in the deps folder (so, the deps weren't added to the classpath for some reason).

    Does anyone know what im doing wrong?

    ( my jdk version is 1.8.0, if that means anything )
    Reply With Quote  
     

  2. #2  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    What you are doing wrong is that you are using a .bat file to compile in 2018. Go download an IDE where it's easy to add all your libs (and helpful in so many other ways).

    I suggest: Eclipse, Netbeans, or IntelIj
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Oct 2014
    Posts
    192
    Thanks given
    31
    Thanks received
    15
    Rep Power
    81
    Quote Originally Posted by Bald View Post
    What you are doing wrong is that you are using a .bat file to compile in 2018. Go download an IDE where it's easy to add all your libs (and helpful in so many other ways).
    im trying to compile it on a server,

    it runs fine on my PC. I just need help with the option to add the libraries to the classpath because it doesn't seem to work :\
    Reply With Quote  
     

  4. #4  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by stav5 View Post
    im trying to compile it on a server
    And...? What does that have to do with anything?
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Oct 2014
    Posts
    192
    Thanks given
    31
    Thanks received
    15
    Rep Power
    81
    Quote Originally Posted by Bald View Post
    And...? What does that have to do with anything?
    it doesn't have a user interface, and even if i can somehow build the code through an IDE via the CLI, i probably wouldnt do it since i can just as easily build it myself
    Reply With Quote  
     

  6. #6  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by stav5 View Post
    it doesn't have a user interface, and even if you can compile through the IDE via the CLI i wouldn't want to have to download it when i can just as easily build it myself
    But you don't seem to be able to easily build it?

    If you use an IDE it will automatically compile for you as you code, and will overall save you tons of time in the long run.
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Oct 2014
    Posts
    192
    Thanks given
    31
    Thanks received
    15
    Rep Power
    81
    Quote Originally Posted by Bald View Post
    But you don't seem to be able to easily build it?

    If you use an IDE it will automatically compile for you as you code, and will overall save you tons of time in the long run.
    Well thats because i dont usually use the CLI to build my code ( which is why im asking what im doing wrong )

    And i do use an IDE when i develop on my own PC.

    Reason i need this is because i want a script on the server that automatically fetches updated files from my git repo and then recompiles the code.

    EDIT:

    So after much intense googling i figured it out:
    Apparently you can't use wildcards in the classpath the way i was doing it.
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Renown Programmer
    Bartvh's Avatar
    Join Date
    May 2017
    Posts
    370
    Thanks given
    89
    Thanks received
    208
    Rep Power
    497
    It's a lot easier to build using Maven or Gradle if you want to build from CLI.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. how to add libraries to buildpath
    By boterkoekje12 in forum Help
    Replies: 5
    Last Post: 01-08-2015, 06:41 PM
  2. Replies: 7
    Last Post: 07-05-2013, 02:13 AM
  3. Replies: 4
    Last Post: 07-04-2013, 11:45 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •