Article View: borland.public.jbuilder.java.language
Article #7255Re: java application cannot run from command line?
From: Stefan Bouynov
Date: Thu, 28 Jun 2001 10:45
Date: Thu, 28 Jun 2001 10:45
31 lines
2109 bytes
2109 bytes
<wuliao999 none> wrote in message news:3b3ae3b8$1_1@dnews... > > When I just install JB4, it's all right. After a period time, > java applications cannot run from command line. For example, I > run an app: > c:>java myApp > then it says: > Exception in thread "main" java.lang.NoClassDefFoundError: myApp The "-classpath" option of the command line compiler/interpreter is very important. The <path> (native OS path with or without a jar file) set in the classpath is the place where the java compiler/interpreter will look for the libraries your app needs to run. This concerns the path to the app you want to start, too (this is your case, interpreter cannot find the class you want to start). There is (at least in Windows) a system variable CLASSPATH, which is used always you run a command line compilation/interpretation. If the path your file is in or the path to pakages your file needs is not in the system CLASSPATH, then you should add it like this: c:>java -classpath "<myApp path>;<packages myApp needs>" myApp > But it runs well before,and in JB4 IDE,it runs as well. Of coure, it will - JB IDE hides all this classpath stuff from you - that's a part of the beauty working with an IDE. Regards, Stefan
Technical Details
Message-ID:
<3b3afb66_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b3ae3b8$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f2109051cc22cbb7 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-28 02:42:01 PST From: "Stefan Bouynov" <bouynov@yahoo.com> Newsgroups: borland.public.jbuilder.java.language References: <3b3ae3b8$1_1@dnews> Subject: Re: java application cannot run from command line? Date: Thu, 28 Jun 2001 12:45:07 +0200 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 212.56.7.50 Message-ID: <3b3afb66_1@dnews> X-Trace: dnews 993721190 212.56.7.50 (28 Jun 2001 02:39:50 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!skynet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews