Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8898833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:42:43+00:00 2026-06-15T00:42:43+00:00

I have a lib folder with many .jar files and one of the files

  • 0

I have a lib folder with many .jar files and one of the files I have is mail.jar (for javax.mail)

When I compile my source code, I use

javac -cp .:../lib/ server/MyFile.java

And then I get a bunch of errors

server/MyFile.java:22: error: package javax.mail.internet does not exist
import javax.mail.internet.InternetAddress;
                          ^
server/MyFile.java:23: error: package javax.mail.internet does not exist
import javax.mail.internet.MimeMessage;
                          ^
server/MyFile.java:24: error: package javax.mail does not exist
import javax.mail.Authenticator;
                 ^
etc
etc

However javax.mail should be inside (via mail.jar). I also have activation.jar inside of the lib folder. Note that this mail.jar file I just downloaded today from sun website. It is recent.

What could be wrong?

UPDATE:

I have added all the jar files manually on the classpath, and it compiles fine. However now when I run MyFile.java, using this command

java server.MyFile

I get this error:

 Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Authenticator
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getMethod0(Class.java:2685)
    at java.lang.Class.getMethod(Class.java:1620)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:492)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:484)
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 6 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:42:44+00:00Added an answer on June 15, 2026 at 12:42 am

    is there an easier way to do this?

    Since version 6, you can use class path wildcards.

        javac -cp .:../lib/* server/MyFile.java
    

    See also this related Q&A.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put my jar files in folder named myLibs under lib folder of
I have one folder named library where I have put all my JAR files.
So I have this code inside my lib/ folder: class GlobalConfig::SetHelper def self.yes_no_input(configuration) value
I have a custom jar file in the tomcat lib/ folder. As per my
I'm using eclipse. In the WEB-INF/lib folder I have the following jars. jstl-api-1.2.jar jstl-impl-1.2.jar
I have created one shell script in my lib folder. And i want to
I have one lib/ folder inside my Eclipse Plugin Project and on this folder
I have an application.war folder (not as file) which contains jaxen-1.1.1.jar (in the WEB-INF/lib)
I have my own lib at folder classes. I am trying to use Zend
I have many different classes under /lib/ folder with many actions. Before saving an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.