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?

I wouldn't think the classpath needs to be set, but I could be wrong.

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

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.

I wouldn't think the classpath needs to be set, but I could be wrong.

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

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.

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

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:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.