Results 1 to 13 of 13
Thread: jar file problem
- 02-11-2010, 12:17 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
jar file problem
hello ,
i'm working on a simple java application..
whenever i create object of the main class in main() method
and try to run jar file from command prompt it' giving the error
"NoClassDefinitionFound".
otherwise the jar file is working absolutely fine.
but, my requirement is that i want to make object of same class in main()
and call one of it's non static method..
can anyone tell me whr i'm going wrong.
- 02-11-2010, 03:48 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
You'll need to post some code, and the full error.
- 02-12-2010, 04:41 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes you must provide more details about the your question.
Is that the same class which contain the main method?my requirement is that i want to make object of same class in main()
- 02-12-2010, 04:51 AM #4
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
1st of all sorry for not posting the code in code tags .
bcoz code tag button is not working in my browser . i don't know why.
hre is my code...
--------------------------------------------------------------------------
public class Main
{
public static void main(String[] args)
{
Main obj=new Main();
obj.doConstructorLogic();
}
private class giveConnection
{
.........
}
private class servicediscovery
implements DiscoveryListener
{
.........
}
private class devicediscovery
implements DiscoveryListener
{
........
}
public void doConstructorLogic()
{
System.out.println("In mains constructor logic");
serviceURL = null;
FinalUrl = null;
UStr = null;
cs = null;
hs = null;
testurl = null;
i = 0;
cnt = 0;
SrNo = -1;
Send_What_flag = "";
pin_cnt = 0;
error_cnt = 0;
redir_errrmsg_cnt = 0;
BT_Dev_cnt = 0;
try
{
local = LocalDevice.getLocalDevice();
discoveryAgent = local.getDiscoveryAgent();
System.out.println((new StringBuilder()).append("Local Device: ").append(local.getFriendlyName()).append(" : ").append(local.getBluetoothAddress()).toString()) ;
local.setDiscoverable(0);
giveConnection connobj = new giveConnection();
try {
conn = connobj.ConnectionType4Provider();
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try
{
try {
connobj.Empty_BT_Table(conn);
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
try {
connobj.Empty_BT_Confirmation(conn);
} catch (SQLException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
int n = connobj.Enter_info(conn);
System.out.println((new StringBuilder()).append("n :").append(n).toString());
}
catch(SQLException ex)
{
ex.printStackTrace();
}
catch(ParseException ex)
{
ex.printStackTrace();
}
}
catch(Exception e)
{
message = "Local Device Not Found";
return;
}
devicediscovery dd = new devicediscovery();
}
}
-------------------------------------------------------------------------
i can not make doConstructor Logic() method static bcoz all the variables it uses are nonstatic and due to some other limitations..
this code is working very properly in netbeans 5.5 ide but whenever i try to run the application from command prompt , its throwing the following error.
"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/bluetooth/UUID
at test_bt.Main.<init>(Main.java:950)
at test_bt.Main.main(Main.java:54)
"
line 54 is that whr i'm creating Main's instance.
i'm using following command to run the file..
java -jar "Demo_BT.jar"
- 02-12-2010, 04:57 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
DO NOT use Main for the class name in Java. It's reserved word in main method, entry point. Change it as soon as possible, very bad practice.
- 02-12-2010, 04:59 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you please tell me where the doConstructorLogic() method located, in which class?
- 02-12-2010, 05:05 AM #7
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
change the class name ,
but no difference . it's giving same error.
- 02-12-2010, 05:07 AM #8
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
doConstructorLogic() is located in same Main class, which name now i've changed.
- 02-12-2010, 05:31 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-12-2010, 05:32 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 02-12-2010, 05:49 AM #11
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
i've already shown that in the code snippet provided earlier..
all the classes within main class are private..
- 02-12-2010, 07:51 AM #12
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Um:
"NoClassDefFoundError: javax/bluetooth/UUID"
It's got nothing to do with Main...which is why I asked for the actual exception.
Which line is line 950?
- 02-12-2010, 09:06 AM #13
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Jar File Problem
By Moncleared in forum New To JavaReplies: 10Last Post: 10-18-2009, 07:43 AM -
jar file problem
By nishant.4545 in forum New To JavaReplies: 1Last Post: 07-03-2009, 08:36 PM -
problem with jar file
By biba84 in forum Advanced JavaReplies: 7Last Post: 11-09-2008, 06:46 PM -
problem - using a jar file
By jon80 in forum New To JavaReplies: 6Last Post: 07-07-2008, 07:49 AM -
problem with jar file pls help
By jinu5 in forum New To JavaReplies: 0Last Post: 08-15-2007, 10:41 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks