🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8524

Re: CLASSPATH

#8524
From: Gary Labowitz
Date: Sun, 18 Mar 2001 15:14
71 lines
3594 bytes
Don't know about Forte, but running it with command line gives a variety of
problems.
Generally it is a good idea in development to put ;. in CLASSPATH just to
make it easy to change path's for each compile.
If the working directory is set to the full path, set CLASSPATH to . so it
will reference it, and then compile.
If the working directory is elsewhere, set CLASSPATH to the full base
directory and fully reference the path to the .java file, and then compile.
If the working directory is set to the base directory of the package, then
no CLASSPATH is needed, but the .java file will have to be referenced with
its full path.

BTW, you won't need "public" on the class or constructor for Other since it
is in the same package.
Gary
"Harry J. Kobetitsch" <kobet@ix.netcom.com> wrote in message
news:991cm4$i8t$1@slb7.atl.mindspring.net...
> I am running Windows 2000 and I am using the Java 2 SDK and
> Forte 2.0. I also used Command Prompt and using javac from the
> command line and I get the same type of problem.
>
> I have set CLASSPATH to C:\Harry\Java
> I have the following two classes that I am trying to build
> Other.class and OtherTest.class
>
> Other.java contains:
> -----------------------------------------------
> // Creating a package
> package com.kobet.samples;
> public class Other {
>    public Other() {
>       System.out.println("com.kobet.samples.Other");
>    }
> }
>
> OtherTest.java contains:
> ---------------------------------------------------
> import com.kobet.samples.*;
> public class OtherTest {
>    public static void main(String[] args) {
>       Other o = new Other();
>    }
> }
>
> I compile Other.java and I put the resulting Other.class in
> C:\Harry\Java\com\kobet\samples
>
> When I try to compile OtherTest.java I get the following error
> messages:
>
> In Forte 2.0
> OtherTest.java [2:1] Package com.kobet.samples. not found in import.
> import com.kobet.samples.*;
>                                                ^
> 1 error
>
>
> When I use the command line I get what looks like a good compile
> of OtherTest.class but when I run
> java OtherTest
> I get the following message:
> Exception in thread "main" java.lang.NoClassDefFoundError: OtherTest
>
> Do I have the CLASSPATH set up correctly?
>
>
>
>
>
>
>
Technical Details
Message-ID: <Dh4t6.140$7d.11194@newshog.newsread.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!uchinews!yellow.newsread.com!netaxs.com!newsread.com!POSTED.newshog.newsread.com!not-for-mail
References: <991cm4$i8t$1@slb7.atl.mindspring.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10a146,21ace6450f42c0b
X-Google-Attributes: gid10a146,public
X-Google-Thread: 113ae9,21ace6450f42c0b
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f74b3,21ace6450f42c0b
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-18 07:16:04 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!uchinews!yellow.newsread.com!netaxs.com!newsread.com!POSTED.newshog.newsread.com!not-for-mail
From: "Gary Labowitz" <garyl@enter.net>
Newsgroups: borland.public.jbuilder.java.language,comp.lang.java.help,comp.lang.java.programmer
References: <991cm4$i8t$1@slb7.atl.mindspring.net>
Subject: Re: CLASSPATH
Lines: 73
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
Message-ID: <Dh4t6.140$7d.11194@newshog.newsread.com>
Date: Sun, 18 Mar 2001 15:14:43 GMT
NNTP-Posting-Host: 207.16.154.183
X-Complaints-To: Abuse Role <abuse@enter.net>, We Care <abuse@newsread.com>
X-Trace: newshog.newsread.com 984928483 207.16.154.183 (Sun, 18 Mar 2001 10:14:43 EST)
NNTP-Posting-Date: Sun, 18 Mar 2001 10:14:43 EST
Organization: ENTER.net (enter.net)