Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Importing library for server

  1. #1
    Junior Member
    Join Date
    Apr 2022
    Thanked 0 Times in 0 Posts

    Default Importing library for server

    I need help compiling and running my programs using the command-line prompt or on my desktop rather than using an IDE. Specifically I do not know how to make my import statements work in my programs without my IDE while I have moved my library now which is a folder containing additional .java files to my Downloads directory. For example my programs, three of them are in Downloads and in this folder I have my library as a folder which is named socklib and I wish to convert the following statements in order to have no resulting errors:

    //Program 1: GreeterClientExample.java
    package com.school.course.example;
    import com.school.course.socklib.ClientProtocolFactory;
    import com.school.course.socklib.ClientSocket;
    import java.util.Scanner;

    //Program 2: GreeterServerExample.java
    package com.school.course.example;
    import com.school.course.socklib.ServerListener;
    import java.util.Scanner;

    //Program 3: GreeterServerProtocol.java
    package com.school.course.example;
    import com.school.course.socklib.ListenerInfo;
    import com.school.course.socklib.SimpleSocketProtocol;
    import java.io.IOException;
    import java.net.Socket;

    I read online there are many different types of imports in Java such as <library> or using / instead . and I am not sure how to make this work or what my path should be either. If anyone is able to help me with this, my directory structure is /Users/user/Downloads/...

  2. #2
    Member Helium c2's Avatar
    Join Date
    Nov 2023
    Kekaha, Kaua'i
    Thanked 1 Time in 1 Post

    Default Re: Importing library for server

    It has to be in separate directories. IDE is preferred because all your programs which is integrated in the websites can work on separate directories and editors. As for putting this on another web page like a button to place on, that's done by exporting the files to the right URL. Using two different pc for the programming.

Similar Threads

  1. Replies: 3
    Last Post: August 31st, 2018, 07:58 AM
  2. Replies: 0
    Last Post: September 4th, 2017, 01:24 AM
  3. NetBeans - Importing an HTML based API Library
    By Khalon in forum Java IDEs
    Replies: 2
    Last Post: April 9th, 2012, 01:04 PM
  4. Importing gif/pictures
    By javanerd in forum Java Theory & Questions
    Replies: 2
    Last Post: October 31st, 2010, 11:58 PM

Tags for this Thread