jars and classpaths

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2005
Posts: 20
Reputation: MonkeyCode is an unknown quantity at this point 
Solved Threads: 0
MonkeyCode MonkeyCode is offline Offline
Newbie Poster

jars and classpaths

 
0
  #1
Jan 5th, 2006
Hello DaniWeb,
. I was hoping someone could help me with a portability issue.
. I've created a jar in JBuilder Foundation 2005. Said jar executes successfully on computers Alpha and Beta, but not Cimarron. When I double-click on the icon on Cimarron, a small black window flashes up and disappears. After clicking a hundred times or so to figure out what it says, I figured out that it says "Exception in thread "main" java.lang.NoClassDefFoundError C:\Sun\AppServer\jdk\bin\DMS-DNMS/jar" or "
... D:\Documents and Settings\lab\Desktop\DMS-DNMS/jar"
. I'm using an executable jar rather than command-line code because my users aren't programmers, and I don't want them to have to do anything other than double-click on an icon to make the program run.
. I have installed the latest jdk on Cimarron. I tried the program from both the desktop and inside the jdk bin. The desktop is on a different drive than the jdk, which is on the C drive, but it didn't run in the jdk folder either.
. I'm suspecting the problem lies in my immortal nemesis, the classpath, but I'm not sure how to confirm this.
. Oh, and just so you know, my manifest does list the appropriate file holding the "main". Pretty sure it wouldn't work on Alpha or Beta otherwise.
. So, what should I look for? I haven't tried other executable jars or any kinds of programs on Cimarron yet, so I don't know whether it simply hates all Java... that would be good to check out... anything else?
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: jars and classpaths

 
0
  #2
Jan 5th, 2006
I wouldn't think the classpath needs to be set, but I could be wrong.


  1. C:\Sun\AppServer\jdk\bin\DMS-DNMS/jar" or "
  2. ... D:\Documents and Settings\lab\Desktop\DMS-DNMS/jar"
  3.  

Looks like it's expecting to find a class somewhere on the users computer which is on computer a and computer b, but not on computer c.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 20
Reputation: MonkeyCode is an unknown quantity at this point 
Solved Threads: 0
MonkeyCode MonkeyCode is offline Offline
Newbie Poster

Re: jars and classpaths

 
0
  #3
Jan 5th, 2006
Originally Posted by server_crash
I wouldn't think the classpath needs to be set, but I could be wrong.


  1. C:\Sun\AppServer\jdk\bin\DMS-DNMS/jar" or "
  2. ... D:\Documents and Settings\lab\Desktop\DMS-DNMS/jar"
  3.  

Looks like it's expecting to find a class somewhere on the users computer which is on computer a and computer b, but not on computer c.
Well, the above paths (C:...DMS-DNMS/jar and D:...DMS-DNMS/jar) are the two places where the jar is located (on Cimarron, that is. On Alpha and Beta, I don't get a directory listing because I don't get an error message). The theory is the jre would read the manifest, the manifest would point it to the appropriate file with MAIN in it, and it would then have completely different errors (because I'm still working on this beast), but the parts I've fixed definitely work on Alpha and Beta. It doesn't look like it's even checking the manifest on Cimarron.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Solved Threads: 8
hooknc hooknc is offline Offline
Posting Whiz in Training

Re: jars and classpaths

 
0
  #4
Jan 5th, 2006
There could be couple of issues.

The system classpath could be different on each machine.

The way that jar files were setup to execute could be different.

One way to see what is actually happening with that jar file is to open a command prompt window move to the directory your jar is in and execute it from the command line. That way you will see exactly what the error is.

Regards,

Nate
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 20
Reputation: MonkeyCode is an unknown quantity at this point 
Solved Threads: 0
MonkeyCode MonkeyCode is offline Offline
Newbie Poster

Re: jars and classpaths

 
0
  #5
Jan 18th, 2006
Originally Posted by hooknc
There could be couple of issues.

The system classpath could be different on each machine.

The way that jar files were setup to execute could be different.

One way to see what is actually happening with that jar file is to open a command prompt window move to the directory your jar is in and execute it from the command line. That way you will see exactly what the error is.

Regards,

Nate
Thanks for the suggestion! Horror upon horrors, it works fine from the command prompt>java -jar program.jar . But I don't want the users to have to go through that mess.
. I ended up going into Windows Explorer, and adding a file type association and action for jar files. 's'funny, I woulda thought that the jdk install should have done something of the sort. But it works now. Only oddity now is that a command window pops up on computer Cimarron, where it doesn't on Alpha or Beta... makes figuring problems easier with the error messages (it reminded me to add the appropriate .dlls to the right places, which I hadn't yet), but just a bit confusing for the users to have an extra thing pop up on the screen.

Anywho, me happy. :mrgreen: :cheesy:
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC