Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

classpath woes -newbie

Thread view: 
jsons - 11 Jul 2007 15:22 GMT
First of all, my apologies, I am a VB programmer [ducking tomatoes and
stones]. I humbly come to this group for guidance, since my vb
communities have been unable to assist.

I was given a java application and asked to call it from a web page
(ASP.Net). Sounds simple enough, I have called external apps from web
pages before, falling off a donkey easy, right?.

I wrote a simple batch file to call the java app and tested it through
the command line on the server, life is good:

RunJava batch code:

cd C:\JavaApp
"C:\Program Files\Java\jdk1.5.0_12\bin\java"  JavaApp Arg1 Arg2 >> c:
\JavaApp\outfile.txt

Then I call the RunJava batch file from my ASP page... not so good. My
output gives an error:

Exception in thread "main"
java.lang.NoClassDefFoundError: C:\Program Files\App 3/0\javajar/jar

Please NOTE: My original classpath has spaces and dots in it. I
enclosed everything in double quotes but the error message had changed
to dots in the path to slashes.

ie:
classpath = C:\Program Files\App 3.0\javajar.jar
error reads C:\Program Files\App 3/0\javajar/jar

I moved the jar file to a more simple location, relative to the java
app:
C:\JavaApp\classes\javajar.jar

but get the same error. Ugh.

I tried using the -classpath switch, but get the same error, EVEN when
running through command prompt, NOT just through ASP page. Stranger
and stranger things are amiss.

I have tried obvious (to me, at least) solutions such as permissions,
changing directories, changing dots to slashes and using chr(46)
functions through ASP to force the dot to an ansii dot which, by the
way, gave the same error only it left the dots in place...

I am at the end of 'java-less knowledge' rope and have not found any
help elsewhere on the web. With all respect and humility I turn to the
gurus of this group for enlightenment.

Any suggestions are greatly appreciated and will be tested and replied
to.

Shoot the donkey.
Roedy Green - 12 Jul 2007 03:33 GMT
>Exception in thread "main"
>java.lang.NoClassDefFoundError: C:\Program Files\App 3/0\javajar/jar

see
http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR

http://mindprod.com/jgloss/classpath.html

http://mindprod.com/jgloss/jar.html

You are better off to bundle your class files is a jar and then invoke
it with

java -jar  thatjar.jar arg1 arg2 >>

--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
jsons - 13 Jul 2007 15:49 GMT
Thank you, I will try that out.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.