last day (14 days later) » 
05:00 - 07:0007:00 - 10:00

5:21 AM
4
Q: Error while running jar file on system

androidGenXI am having a java file like the following: import org.xBaseJ.DBF; import org.xBaseJ.fields.CharField; import org.xBaseJ.fields.NumField; import org.apache.log4j.*; public class Example2 { public static void main(String args[]){ .......... } } I have created the this to 'Example2.jar' file t...

 
@Parfait I have Extracted the xBaseJ API jar and make it a folder as jar and then doing the manipulations. I didnt set classpath
 
I think the reason is its not able to find the class file which is generated so that is why its giving error. and from where u running this jar and is it containing any external libraries. ?
 
@Krishna I am running from the same location where my org folder and my java file resides
 
@androidGenX are u using netbeans?
@androidGenX are u having any external dependencies in your class i mean do u using any api in that java file?
 
@Krishna yes, I am using xbasej api, which jar file I have set on my classpath
@Parfait I have already added xBaseJ API jar file on my class path
 
5:21 AM
@androidGenX means into the jdk Right?
 
Krishna yes buddy I am into jdk
 
@androidGenX okey have u add menifest file with infiormation of main class?
 
yes manifest file is there it is having content Main-Class: Test
 
@androidGenX and into the file dont even put space before that content okey check it again.
 
When I run the java Example2 it is working, and I can create jar file also but when I try to run jar file it is showing error
 
5:26 AM
@androidGenX check name manifest.txt
 
yes it is
 
@androidGenX okey just min
 
manifest.txt
help me buddy need to hand over this to client
here they dnt allow to use IDEs
 
@androidGenX dont worry i am working on it just wait few min :)
 
ok buddy thanks
import org.xBaseJ.DBF;

public class Test
{
public static void main(String args[]){

try{

//Open dbf file
DBF classDB=new DBF("Germany.dbf");
System.out.println("here");
}
catch(Exception e){
}

}
}
This is how my program looks
 
5:33 AM
@androidGenX its not consult with program just its not finding file that is it wait.
 
ohh ok buddy
 
@androidGenX okey just min i got some info
 
all the path of API is set on class path, so wen we make bundle i mean jar it should include na??
 
@androidGenX got solution haha
 
tell me buddy
 
5:36 AM
Class-Path: Member.jar put this tag in your menifist and just paste that jar file into the same folder.
 
jar files means what i set on class files?? same ones????
 
@androidGenX try it and let me know
 
ok buddy w8 iam tring
 
just tell me if u dont got it. i will explain
 
:(
No change buddy same error
 
5:41 AM
@androidGenX what u getting?
 
C:\TIPL\GCST>javac Test.java

C:\TIPL\GCST>java Test
here

C:\TIPL\GCST>jar cfe Test.jar Test Test.class

C:\TIPL\GCST>java -jar Test.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Test.main(Test.java:10)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
what to do buddy??? :(
 
jar cfm jarname.jar manifest.txt classnames.class try this command
Show me your menifest.txt
 
Main-Class: Test

Class-Path: Member.jar
 
areee put jars that u want in your project.
ex
Main-Class: Member
Class-Path: Member.jar
Dont even put space init.
and is your jar file is generated in your same folder?
 
yes it is generated
but same error
I will tell you
 
5:45 AM
okey just open that jar and show me menifest inside that.
extract that jar and u will se menifest.mf something like that file inside that
 
I have jar files xbasej-20091203.jar, log4j.jar which are depended to my pgm
ok w8
 
okey and even tell me that what are the class u need i will make command for u.
 
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: moscac
Build-Jdk: 1.6.0_17
this is inside xbasej-20091203.jar
 
is this file what u are generation by command?
 
C:\TIPL\GCST>jar cfm jarname.jar manifest.txt Test.class

C:\TIPL\GCST>-jar jarname.jar
'-jar' is not recognized as an internal or external command,
operable program or batch file.

C:\TIPL\GCST>java -jar jarname.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Test.main(Test.java:10)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
 
5:49 AM
are run like this java -jar jarname.jar
 
No buddy that is an api xbasej
yes i run like that
Am i need change the command to run jar file???
 
m not taking about xbase or what ever jar u are including brother. just tell me when u running this code "jar cfm jarname.jar manifest.txt Test.class" i want meniest of the jar file which is generated as jarname.jar
nope command is okey.
 
you mean I need to extract that jar and need to show you manifest.jar, right???
 
yes
show me fast
 
ok w8
Manifest-Version: 1.0
Created-By: 1.8.0_25 (Oracle Corporation)
Main-Class: Test
it is coming like this
 
5:53 AM
okey look its not including jar did u see that.?
 
is there any problem??
 
yes there is problem
 
yah so how can make that include jars??
 
Manifest-Version: 1.0
Class-Path: Member.jar
Created-By: 1.7.0_60 (Oracle Corporation)
Main-Class: Member
look this is my manifest what is created.
can u see "Class-Path: Member.jar " is included
 
so how can I make like yours??
 
5:55 AM
wait i will do for u.
just tell me your jar names.
 
please guide me i am new to u
to this sorry
xbasej-20091203.jar, log4j.jar
 
okey just show me your menifest.txt that u are including before making that jar/
 
these i set as classpaths
ok
 
okey no prob.
 
Main-Class: Test

Class-Path: Member.jar
 
5:56 AM
just min wait.
 
okey buddy
 
Main-Class:Test u need to add your mainclass name in that okey/
 
how??
 
Class-Path: lib/xbasej-20091203.jar lib/log4j.jar
paste this file in your manifest.txt
i mean paste that line
 
Inside manifest before I create jar right???
 
5:58 AM
ya u got the point
paste it.
 
okey and just show me that file here before u run command
 
did
w8
 
okey show here.
 
Main-Class: Test

Class-Path: lib/xbasej-20091203.jar lib/log4j.jar
is it right??
 
6:01 AM
yes but before u run just remove that spaces between lines.
and have u make lib folder in same folder where ur menifest.txt file is?
 
paste that both jar inside that lib
 
                                                        C:\TIPL\GCST>jar cfm jarname.jar manifest.txt Example2.class                                                            C:\TIPL\GCST>java -jar jarname.jar                          Error: Could not find or load main class Test                                                                           C:\TIPL\GCST>
jar created
and getting error like this
 
main class?
 
yah
 
6:05 AM
show me menifest file that is created inside class?
jar i mean
 
Main-Class: Example2

Class-Path: lib/xbasej-20091203.jar lib/commons-logging-1.1.1.jar
 
okey its correct i find where prob is. :d
your command is wrong wait.
 
run this command jar cfm jarname.jar manifest.txt mainclass.class
 
Sorry buddy am I troubling u??
 
6:08 AM
u need to provide your mainclass class in at last in command.
dont think about troubling just do it.
complate it once.
u got my point?
u have not provided to the command and java that which is main class so its asking u that i am not able to load main class as of u have not tell me which is main class :)
 
C:\TIPL\GCST> jar cfm jarname.jar manifest.txt Example2.class

C:\TIPL\GCST>java -jar jarname.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Example2.main(Example2.java:14)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
 
simple as that.
 
COMES IT BACK TO MY ERROR
I DNT KNOW WATS HAPPENING
:( :( :(
 
show me menifest.mf that is created inside jar.
 
w8 dude i wanna start from a small example
import org.xBaseJ.DBF;

public class Test
{
public static void main(String args[]){

try{

//Open dbf file
DBF classDB=new DBF("Germany.dbf");
System.out.println("here");
}
catch(Exception e){
}

}
}
this is my class
and i do step by step not make it complicated
w8 one sec
Main-Class: Test

Class-Path: lib/xbasej-20091203.jar lib/commons-logging-1.1.1.jar
this is manifest
 
6:14 AM
yes
but dont put space between that.
 
C:\TIPL\GCST>javac Test.java

C:\TIPL\GCST>java Test
here

C:\TIPL\GCST>jar cfm jarname.jar manifest.txt Test.class

C:\TIPL\GCST>java -jar jarname.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Test.main(Test.java:10)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
this is i got
wat shuld be problem
w8 i will show manifest on created jar
Manifest-Version: 1.0
Created-By: 1.8.0_25 (Oracle Corporation)
Main-Class: Test
 
make folder name lib in the same folder where your menifest.txt is paste your jars there
 
it is not puttong that line related with jar
yes same what i am doing
is it because of spacing in manifest??
Main-Class: Test
Class-Path: lib/xbasej-20091203.jar lib/commons-logging-1.1.1.jar
is it right???????
 
ya true/
and your generated menifest.mf should be something like this
Manifest-Version: 1.0
Created-By: 1.8.0_25 (Oracle Corporation)
Main-Class: Test
Class-Path: lib/xxxx.jar lib/xxx.jar
 
let me try once again w8 a sec
 
6:19 AM
okey ask if u not gettting it still
 
C:\TIPL\GCST>javac Test.java

C:\TIPL\GCST>java Test
here

C:\TIPL\GCST>jar cfm jarname.jar manifest.txt Test.class

C:\TIPL\GCST>java -jar jarname.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Test.main(Test.java:10)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
same error buddy
I dnt know wats happening
 
show me menifest
indside jar.
 
Manifest-Version: 1.0
Created-By: 1.8.0_25 (Oracle Corporation)
Main-Class: Test
I dont know why it is not geeting those jars???
 
its okey wait. put jars in same folder.
 
ok then??
 
6:22 AM
then in your txt file
replce jar line with this
Class-Path: xxx1.jar xxx2.jar
show me txt file after that
 
Main-Class: Test
Class-Path: xbasej-20091203.jar commons-logging-1.1.1.jar
right??
 
correct
 
u have linux or windows.?
 
C:\TIPL\GCST>javac Test.java

C:\TIPL\GCST>java Test
here

C:\TIPL\GCST>jar cfm jarname.jar manifest.txt Test.class

C:\TIPL\GCST>java -jar jarname.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/xBaseJ/DBF
at Test.main(Test.java:10)
Caused by: java.lang.ClassNotFoundException: org.xBaseJ.DBF
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
same issue
w8 a sec i will give you my jar files, can you try in ur system???
tell buddy
 
6:26 AM
sure
give me
 
w8
try with this and my Test.java code and tell me buddy what is happening
 
okey
wait
 
ok buddy
tell me wats happening
 
okey wait min
give me your main class
 
import org.xBaseJ.DBF;

public class Test
{
public static void main(String args[]){

try{

//Open dbf file
DBF classDB=new DBF("Germany.dbf");
System.out.println("here");
}
catch(Exception e){
}

}
}
If u get any error then u need to add commons-logging-1.1.1.jar also
 
6:32 AM
okey
 
tell me if u get any error wen u compile
 
just min m on it. okey
 
okey buddy,
do it and if u are getting then do paste ur cmd here
got??
 
yes but i dont have dbf file.
i mean that database file inme.
 
yah
simple download a test dbf file and paste it
 
6:38 AM
just min
 
ok buddy
I am using confidential DBF buddy thats y.
sorry 4 inconvenince
Krishna buddy u there??
 
yes
 
u got sample??
 
it will show unknown database because it will not find databse.
i can do with out that let me try
 
6:42 AM
give me link to sample db file.
if possible
 
ok w8
will send u a sample
tell ur email id buddy
I have a sample
krishna
tell me ur personal mail id if u didnt get sample dbf
i will send one
Krishna buddy u there??
Krishna
:(
u got???
 
okey
just min
u working on it.
 
need sample dbf???
 
kishan.bheemajiyani@gmail.com b
just wait m trying it
 
dbf send to your mail check ur mail for sample dbf
 
6:55 AM
just wait look i have done
Manifest-Version: 1.0
Class-Path: lib/commons-logging-1.1.1.jar lib/xbasej-20091203.jar
Created-By: 1.7.0_60 (Oracle Corporation)
Main-Class: Test
this is my generated file
 
tell your steps
copy paste the cmd
Please copy paste your CMD here so I can also take a look on it
Krisha u there??
 
okey
 
05:00 - 07:0007:00 - 10:00

last day (14 days later) »