Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33514
| Path | csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: java Environment in Manjaro Linux |
| Date | Fri, 22 Jan 2016 11:16:10 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 58 |
| Message-ID | <n7tkf8$5p1$1@dont-email.me> (permalink) |
| References | <n7tic6$rbh$4@reader1.panix.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Fri, 22 Jan 2016 16:13:28 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="5921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Me1cEo5HfFRjwqeYMlpAw" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
| In-Reply-To | <n7tic6$rbh$4@reader1.panix.com> |
| Cancel-Lock | sha1:mJUGglrrgI+CchYgTb9gSDrVxAw= |
| Xref | csiph.com comp.lang.java.programmer:33514 |
Show key headers only | View raw
On 1/22/2016 10:37 AM, ruben wrote:
> I'm testing the java developers environment and its not working as I
> expected
>
> [ruben@localhost cs664s16]$ cat ./helloworld.java
> public class helloworld {
> public static void main(String[] args) {
> System.out.println("Bonjour le monde !");
> }
>
> }
>
>
> [ruben@localhost cs664s16]$ echo $CLASSPATH
> /home/ruben/GNUstep/Library/Libraries/Java:/root/GNUstep/Library/
> Libraries/Java:/usr/lib/GNUstep/Libraries/Java:.:./
>
>
> [ruben@localhost cs664s16]$ java ./helloworld.java
> Error: Could not find or load main class ..helloworld.java
>
>
> this works however:
>
> [ruben@localhost cs664s16]$ java helloworld
> Bonjour le monde !
>
>
>
> So, I am completely confused. How can it not take the specified file
> name to run?
`helloworld.java' is a source file full of Java source code.
The corresponding class file (produced by the javac compiler) would
be `helloworld.class'. If you're familiar with languages like C or
C++, this is similar to the distinction between `helloworld.c' and
`helloworld.o'.
Furthermore, the java command itself doesn't want either file
name: It just wants the class name `helloworld', and it knows to
look for `helloworld.class' in "various places." In your case it
will find `helloworld.class' as an ordinary file in one of the
directories listed in CLASSPATH, but there are other possibilities
that can be used in other setups. It might find `helloworld.class'
as one member of a "jar file" (a specially-formatted ZIP archive),
or it might be told to load `helloworld.class' from the network,
and still other even more exotic setups can be concocted. The
upshot, though, it that you tell Java the unadorned class name,
not the name of a file.
> Also, where is the $CLASSPATH set? in the system /etc/profile ? I
> should probaly add ./ to the bashrc file?
Sorry; I have no idea what piece of script sets your CLASSPATH.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
java Environment in Manjaro Linux ruben <ceo@iran.gov> - 2016-01-22 15:37 +0000
Re: java Environment in Manjaro Linux Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-01-22 11:16 -0500
Re: java Environment in Manjaro Linux Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-22 20:44 +0000
Re: java Environment in Manjaro Linux ruben <ceo@iran.gov> - 2016-01-22 21:10 +0000
Re: java Environment in Manjaro Linux Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-22 22:25 +0000
Re: java Environment in Manjaro Linux Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-22 23:11 +0000
Re: java Environment in Manjaro Linux Arne Vajhøj <arne@vajhoej.dk> - 2016-01-22 20:45 -0500
Re: java Environment in Manjaro Linux Martin Gregorie <martin@address-in-sig.invalid> - 2016-01-23 11:17 +0000
csiph-web