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 6047439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:21:04+00:00 2026-05-23T07:21:04+00:00

I am having a problem producing a working jar file. I would like to

  • 0

I am having a problem producing a working jar file. I would like to end up with a jar file that can run itself by using the command java -jar myjar.jar

So far I have

<project default="jar" name="Create Runnable Jar fecrudbreset">
<target name="clean">
    <delete dir="bin"/>
    <delete dir="build"/>
</target>
<target name="compile">
    <mkdir dir="./build"/>
    <javac srcdir="./src" destdir="./build">
        <classpath>
            <pathelement location="./lib/sqljdbc4.jar"/>
        </classpath>
    </javac>
</target>
<target name="jar" depends="compile">
    <mkdir dir="./bin"/>
    <jar destfile="./bin/fecrudbreset.jar" >
        <manifest>
            <attribute name="Main-Class" value="FecruDBreset"/>
            <attribute name="Class-Path" value="."/> 
            <attribute name="Built-By" value="${user.name}"/>
        </manifest>
        <fileset dir="./build"/>
        <zipfileset dir="./lib" includes="sqljdbc4.jar"/>
    </jar>
</target>
</project>

The compile works however when I try to run the app I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/sqlserver/jdbc/SQLServerDataSource
    at FecruDBreset.main(Unknown Source)

update:
The main class I have uses the default package. The class is found and starts to run but fails when it cant locate the sql driver it seems. I guess I dont understand why it cant find it.

Here is how the main class is defined:

import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;

public class FecruDBreset
{

/*
 * Used to reset / nuke fecru database
 */
public static void main(String[] args)
{

Also if I unzip the jar file that is produced the contents look like this:

META-INF/
META-INF/MANIFEST.MF
FecruDBreset.class
sqljdbc4.jar

Update 2: My source tree looks like this:

|-- bin
|   `-- fecrudbreset.jar
|-- build
|   `-- FecruDBreset.class
|-- build.xml
|-- lib
|   `-- sqljdbc4.jar
|-- readme.txt
`-- src
    `-- FecruDBreset.java

Anyone have any idea what I am doing wrong? Thanks much in advance.
Chad

  • 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-05-23T07:21:05+00:00Added an answer on May 23, 2026 at 7:21 am

    @chadneal: Also if I unzip the jar file that is produced the contents look like this:

    META-INF/
    META-INF/MANIFEST.MF
    FecruDBreset.class
    sqljdbc4.jar
    

    The main Jar cannot contain the sqljdbc4.jar. Instead, a reference to that Jar should be added to the class-path in the manifest.

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

Sidebar

Related Questions

We are having problem with the server migration. We have one application that are
I am having problem in getting reference of Ajax control extender using $find() or
I'm having problem selecting an element with an id like this <li =0f:Bactidol_Recorder.mp4>. I
I'm having problem restricting a query in mdx, using except function at where clause.
I am having a problem with my bash script. It is producing an error
I am working on producing an xml document from python. We are using the
I am having a problem with a generic regex that matches (sort of) a
i having problem understanding what is wrong with my inheritance. I just can not
I am using spring MVC and having a problem in jsessionid, what I found
Having problem in IE8 with vertical align for images not working when a table

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.