MESSAGE
DATE | 2016-01-22 |
FROM | Christopher League
|
SUBJECT | Re: [Learn] CS664
|
From learn-bounces-at-nylxs.com Fri Jan 22 19:55:07 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id D267D16249E; Fri, 22 Jan 2016 19:55:06 -0500 (EST) X-Original-To: learn-at-www.mrbrklyn.com Delivered-To: learn-at-www.mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 1000) id 19B1F16112C; Fri, 22 Jan 2016 19:17:11 -0500 (EST) Resent-From: Ruben Safir Resent-Date: Fri, 22 Jan 2016 19:17:11 -0500 Resent-Message-ID: <20160123001711.GB6893-at-www.mrbrklyn.com> Resent-To: learn-at-mrbrklyn.com X-Original-To: ruben-at-mrbrklyn.com Delivered-To: ruben-at-mrbrklyn.com Received: from B-EXH-EDGE1.liunet.edu (b-edge1.smtp.liu.edu [148.4.248.206]) by mrbrklyn.com (Postfix) with ESMTP id 5189316112B for ; Fri, 22 Jan 2016 13:54:16 -0500 (EST) Received: from B-EXH-3.liunet.edu (148.4.250.212) by B-EXH-EDGE1.liunet.edu (148.4.248.206) with Microsoft SMTP Server (TLS) id 14.3.210.2; Fri, 22 Jan 2016 13:54:02 -0500 Received: from localhost (96.250.202.23) by B-EXH-3.liunet.edu (148.4.250.212) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Fri, 22 Jan 2016 13:54:14 -0500 From: Christopher League To: Ruben Safir In-Reply-To: <56A24F27.4030101-at-mrbrklyn.com> References: <87h9i64kkg.fsf-at-lydrik.home.lan> <20160122131000.GA17212-at-www.mrbrklyn.com> <87bn8d4sr5.fsf-at-lydrik.home.lan> <56A245B9.6080400-at-mrbrklyn.com> <87si1p3afh.fsf-at-lydrik.home.lan> <56A24F27.4030101-at-mrbrklyn.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu) Date: Fri, 22 Jan 2016 13:54:11 -0500 Message-ID: <87mvrx30oc.fsf-at-lydrik.home.lan> MIME-Version: 1.0 X-Originating-IP: [96.250.202.23] X-ClientProxiedBy: U-EXH-CAS.liunet.edu (148.4.184.26) To B-EXH-3.liunet.edu (148.4.250.212) X-UID: 5806 Subject: Re: [Learn] CS664 X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0747997716==" Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
--===============0747997716== Content-Type: multipart/signed; boundary="===-=-="; micalg=pgp-sha256; protocol="application/pgp-signature"
--===-=-= Content-Type: multipart/mixed; boundary="=-=-="
--=-=-= Content-Type: multipart/alternative; boundary="==-=-="
--==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable
Yes, the package declaration. Packages correspond to directories, so when you compile this it creates `./com/company/Main.class` and then you run it using
% java com.company.Main
You can leave out the package declaration and it will stay in the same directory.
CL
Ruben Safir writes:
> why doesn't this one work? > > [ruben-at-localhost cs664s16]$ java Main > Error: Could not find or load main class Main > > > [ruben-at-localhost cs664s16]$ javac Main.java > [ruben-at-localhost cs664s16]$ java Main > Error: Could not find or load main class Main > > package com.company; > > public class Main { > > public static void main(String[] args) { > // write your code here > System.out.println("Hello, cs664s16!"); > } > } > > > I presume it has something to do with the package declaration > > > On 01/22/2016 10:23 AM, Christopher League wrote: >>=20 >> Of course it works, you just have it backwards: >>=20 >> - The `.class` file is **binary** like `.o`, so you don't edit it with >> `vim`. >>=20 >> - The `.java` file is your source file, so that's what you edit. >>=20 >> - Then you compile the `.java` file with `javac` (the compiler) and >> that generates the `.class`. >>=20 >> - Then you run the `.class` with `java` which is the virtual machine. >> (But you just specify the name of the class, and leave out the >> `.class`). >>=20 >> - Also, if the declared name of your class (as in `class Hello`) does >> not match the filename (maybe it's `myprog.java`), the class file it >> generates will use the declared name rather than the filename. So >> `myprog.java` still compiles to `Hello.class` if it declares `class >> Hello`. >>=20 >> See transcript: >>=20 >> ~~~~ >> % cat Hello.java >> class Hello { >> public static void main(String[] args) { >> System.out.println("Hello world."); >> } >> } >> % javac Hello.java >> % java Hello >> Hello world. >>=20 >> Script done on Fri 22 Jan 2016 10:18:36 AM EST >> ~~~~ >>=20 >> CL >>=20 >> Ruben Safir writes: >>=20 >>> On 01/22/2016 09:02 AM, Christopher League wrote: >>>> >>>> To get their 1-year license you don't need picture ID if you use a >>>> `.edu` address. And even then you don't need an account because there = is >>>> the **IntelliJ community edition.** The community edition is **free >>>> software** (FSF definition) because it's distributed using the Apache >>>> 2.0 license. >>>> So that should meet your requirements. >>> >>> >>> Or maybe not >>> >>> [ruben-at-localhost cs664s16]$ vim ./Main.class >>> [ruben-at-localhost cs664s16]$ java ./Main.java >>> Error: Could not find or load main class ..Main.java >>> >>> >>> I changed the classpath with no luck >>> >>> [ruben-at-localhost cs664s16]$ vim ./Main.class >>> [ruben-at-localhost cs664s16]$ java ./Main.java >>> Error: Could not find or load main class ..Main.java >>> [ruben-at-localhost cs664s16]$ java -classpath .:$CLASSPATH Main. >>> Main.class Main.java >>> [ruben-at-localhost cs664s16]$ java -classpath .:$CLASSPATH Main.java >>> Error: Could not find or load main class Main.java >>> [ruben-at-localhost cs664s16]$ set|grep CLASS >>> CLASSPATH=3D.:.:/home/ruben/GNUstep/Library/Libraries/Java:/root/GNUste= p/Library/Libraries/Java:/usr/lib/GNUstep/Libraries/Java >>> >>> >>>> >>>> However, yes -- we can proceed with your preferred `vi`/`sh` IDE. When >>>> programs get more complicated than Hello World, you'll want a build >>>> system. (Unfortunately, `make` doesn't work so well for Java.) To build >>>> non-trivial programs, I recommend `gradle` (also Apache 2.0). >>>> >>>> >>>> So here's the essence of the software setup: >>>> >>>> - You still need an account on -- that's a >>>> server I administer (although it is virtual) and it's free software >>>> >>>> >>>> - Upload your SSH public key to that server so that `git` can log in. >>>> >>>> - Create a project on that server, as described in the instructions. >>>> >>>> - Give my account access to your project on the server. >>>> >>>> - `git clone` using the URL for the project, so now you have a local >>>> copy. >>>> >>>> - Create a Java "hello world" program, build and test it. (Can just >>>> use `javac` to compile and `java` to run -- either go with JDK7 if >>>> you're okay with that license, or try OpenJDK8. >>>> >>>> - Then do `git add` then `git commit` and `git push` to upload your >>>> code to the server where I can access it. >>>> >>>> That's all I need for right now. When we have some more classes and >>>> libraries, we can talk about getting `gradle` to build the code. >>>> >>>> Also, work on the exercises in the language theory notes -- they will >>>> help. >>>> >>>> CL >>>> >>>> >>>> Ruben Safir writes: >>>> >>>>> OK - to be fair, I looked at the jetbrain, it I'm not sending them pi= cture ids >>>>> of me, or agreeing with their license.=20=20 >>>>> >>>>> So please, Dr League, just tell me what you want for the first assign= ment >>>>> and I'll figure it out. I don't need a broken and encumbered editor = with >>>>> integrated git access. I have shells, and X11, git and such.=20=20 >>>>> >>>>> CHRIS I HAVE CANCER, a bone tumor planted in my hand like a time bomb= . I don't=20 >>>>> want to waste what is left of my life learning the greatest proprieta= ry object=20 >>>>> of the day >>>>> >>>>> >>>>> >>>>> On Thu, Jan 21, 2016 at 05:46:55PM -0500, Christopher League wrote: >>>>>> >>>>>> I added some fairly comprehensive notes about language theory: >>>>>> and embedded within th= em >>>>>> are some exercises you probably should try, to make sure you underst= and >>>>>> about automata and grammars. >>>>>> >>>>>> I also uploaded instructions for setting up your Git server account = and >>>>>> Java development environment: > so >>>>>> you can get started with that. >>>>>> >>>>>> The software setup instructions form the first part of assignment 1,= but >>>>>> there will be a bit more yet to come (probably available by Friday >>>>>> afternoon). >>>>>> >>>>>> CL >>>>> >>>>> >>>>> >>>>> >>>>> --=20 >>>>> So many immigrant groups have swept through our town >>>>> that Brooklyn, like Atlantis, reaches mythological >>>>> proportions in the mind of the world - RI Safir 1998 >>>>> http://www.mrbrklyn.com=20 >>>>> >>>>> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 >>>>> http://www.nylxs.com - Leadership Development in Free Software >>>>> http://www2.mrbrklyn.com/resources - Unpublished Archive=20 >>>>> http://www.coinhangout.com - coins! >>>>> http://www.brooklyn-living.com=20 >>>>> >>>>> Being so tracked is for FARM ANIMALS and and extermination camps,=20 >>>>> but incompatible with living as a free human being. -RI Safir 2013 >>>> >>> >>> >>> --=20 >>> So many immigrant groups have swept through our town >>> that Brooklyn, like Atlantis, reaches mythological >>> proportions in the mind of the world - RI Safir 1998 >>> http://www.mrbrklyn.com >>> >>> DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 >>> http://www.nylxs.com - Leadership Development in Free Software >>> http://www2.mrbrklyn.com/resources - Unpublished Archive >>> http://www.coinhangout.com - coins! >>> http://www.brooklyn-living.com >>> >>> Being so tracked is for FARM ANIMALS and and extermination camps, >>> but incompatible with living as a free human being. -RI Safir 2013 >>=20 > > > --=20 > So many immigrant groups have swept through our town > that Brooklyn, like Atlantis, reaches mythological > proportions in the mind of the world - RI Safir 1998 > http://www.mrbrklyn.com > > DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 > http://www.nylxs.com - Leadership Development in Free Software > http://www2.mrbrklyn.com/resources - Unpublished Archive > http://www.coinhangout.com - coins! > http://www.brooklyn-living.com > > Being so tracked is for FARM ANIMALS and and extermination camps, > but incompatible with living as a free human being. -RI Safir 2013
--==-=-= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
1.0, user-scalable=3Dyes">
Yes, the package declaration. Packages correspond to directories, so whe= n you compile this it creates ./com/company/Main.class and the= n you run it using
% java com.company.Main
You can leave out the package declaration and it will stay in the same d= irectory.
CL
Ruben Safir ruben-at-mrbrklyn.com= writes:
why doesn=E2=80=99t this one work?
[ruben-at-localhost cs664s16]$ java Main Error: Could not find or load main= class Main
[ruben-at-localhost cs664s16]$ javac Main.java [ruben-at-localhost cs664s16]$ = java Main Error: Could not find or load main class Main
package com.company;
public class Main {
public static void main(String[] args) { // write your code here System.out.println("Hello, cs664s16!"); }
}
I presume it has something to do with the package declaration
On 01/22/2016 10:23 AM, Christopher League wrote: > > Of course it= works, you just have it backwards: > > - The .class fil= e is binary like .o , so you don=E2=80=99t edi= t it with > vim . > > - The .java file is= your source file, so that=E2=80=99s what you edit. > > - Then you co= mpile the .java file with javac (the compiler) an= d > that generates the .class . > > - Then you run the= .class with java which is the virtual machine. &= gt; (But you just specify the name of the class, and leave out the > de>.class). > > - Also, if the declared name of your class (as= in class Hello ) does > not match the filename (maybe it=E2= =80=99s myprog.java ), the class file it > generates will us= e the declared name rather than the filename. So > myprog.java de> still compiles to Hello.class if it declares class &= gt; Hello . > > See transcript: > > ~~ >= ; % cat Hello.java > class Hello { > public static void main(String[]= args) { > System.out.println(=E2=80=9CHello world.=E2=80=9D); > } &g= t; } > % javac Hello.java > % java Hello > Hello world. > > = Script done on Fri 22 Jan 2016 10:18:36 AM EST > ~~ > >= CL > > Ruben Safir ruben-at-mrbrk= lyn.com writes: > >> On 01/22/2016 09:02 AM, Christopher Leagu= e wrote: >>> >>> To get their 1-year license you don=E2= =80=99t need picture ID if you use a >>> .edu address= . And even then you don=E2=80=99t need an account because there is >>= > the IntelliJ community edition. The community edition= is free >>> software (FSF definition) because it= =E2=80=99s distributed using the Apache >>> 2.0 license. =3D"http://www.gnu.org/licenses/license-list.en.html#apache2" class=3D"uri"= >http://www.gnu.org/licenses/license-list.en.html#apache2 >>> = So that should meet your requirements. >> >> >> Or maybe = not >> >> [ruben-at-localhost cs664s16]$ vim ./Main.class >>= [ruben-at-localhost cs664s16]$ java ./Main.java >> Error: Could not fin= d or load main class ..Main.java >> >> >> I changed the c= lasspath with no luck >> >> [ruben-at-localhost cs664s16]$ vim ./M= ain.class >> [ruben-at-localhost cs664s16]$ java ./Main.java >> Er= ror: Could not find or load main class ..Main.java >> [ruben-at-localhos= t cs664s16]$ java -classpath .:CL>ASSPATHMm>ain.=E2=80=84>=E2=80=84=E2=80=84>=E2=80= =84Main.cla<= em>ssMain.ja= va=E2=80=84>=E2=80=84=E2=80=84>=E2=80=84[r= uben-at-loc>alhostc= s664s16] java -classpath .:C<= /em>LASSPAT<= em>HMain.jav= a=E2=80=84>=E2=80=84=E2=80=84>=E2=80=84Er<= /em>ror=E2=80=84:=E2=80=84Com>uldnotfi= em>ndorloam>dmaincla= em>ssMain.j<= em>ava=E2=80=84>=E2=80=84=E2=80=84>=E2=80=84[<= em>ruben-at-loc= alhostc= s664s16] set|grep CLASS >> CLASSPATH=3D.:.:/= home/ruben/GNUstep/Library/Libraries/Java:/root/GNUstep/Library/Libraries/J= ava:/usr/lib/GNUstep/Libraries/Java >> >> >>> >>= > However, yes =E2=80=93 we can proceed with your preferred vide>/sh IDE. When >>> programs get more complicated th= an Hello World, you=E2=80=99ll want a build >>> system. (Unfortuna= tely, make doesn=E2=80=99t work so well for Java.) To build &g= t;>> non-trivial programs, I recommend gradle (also Apac= he 2.0). >>> = http://gradle.org/license/ >>> >>> So here=E2=80=99s = the essence of the software setup: >>> >>> - You still ne= ed an account on https://g= it.liucs.net/ =E2=80=93 that=E2=80=99s a >>> server I administ= er (although it is virtual) and it=E2=80=99s free software >>> href=3D"https://gitlab.com/gitlab-org/gitlab-ce/blob/master/LICENSE" class= =3D"uri">https://gitlab.com/gitlab-org/gitlab-ce/blob/master/LICENSE &g= t;>> >>> - Upload your SSH public key to that server so that= git can log in. >>> >>> - Create a project = on that server, as described in the instructions. >>> >>>= - Give my account access to your project on the server. >>> >&= gt;> - git clone using the URL for the project, so now you = have a local >>> copy. >>> >>> - Create a Java = =E2=80=9Chello world=E2=80=9D program, build and test it. (Can just >>= ;> use javac to compile and java to run =E2=80= =93 either go with JDK7 if >>> you=E2=80=99re okay with that licen= se, or try OpenJDK8. >>> >>> - Then do git adde> then git commit and git push to upload your &g= t;>> code to the server where I can access it. >>> >>&= gt; That=E2=80=99s all I need for right now. When we have some more classes= and >>> libraries, we can talk about getting gradle = to build the code. >>> >>> Also, work on the exercises in= the language theory notes =E2=80=93 they will >>> help. =3D"https://liucs.net/cs664s16/" class=3D"uri">https://liucs.net/cs664s16/<= /a> >>> >>> CL >>> >>> >>> Rub= en Safir ruben-at-mrbrklyn.com write= s: >>> >>>> OK - to be fair, I looked at the jetbrain,= it I=E2=80=99m not sending them picture ids >>>> of me, or agr= eeing with their license. >>>> >>>> So please,= Dr League, just tell me what you want for the first assignment >>>= ;> and I=E2=80=99ll figure it out. I don=E2=80=99t need a broken and enc= umbered editor with >>>> integrated git access. I have shells, = and X11, git and such. >>>> >>>> CHRIS I HAVE = CANCER, a bone tumor planted in my hand like a time bomb. I don=E2=80=99t &= gt;>>> want to waste what is left of my life learning the greatest= proprietary object >>>> of the day >>>> >>&g= t;> >>>> >>>> On Thu, Jan 21, 2016 at 05:46:55PM= -0500, Christopher League wrote: >>>>> >>>>>= I added some fairly comprehensive notes about language theory: >>>= ;>> uri">https://liucs.net/cs664s16/lang-theory.html and embedded within th= em >>>>> are some exercises you probably should try, to make= sure you understand >>>>> about automata and grammars. >= >>>> >>>>> I also uploaded instructions for sett= ing up your Git server account and >>>>> Java development en= vironment: = https://liucs.net/cs664s16/setup.html so >>>>> you can g= et started with that. >>>>> >>>>> The softwar= e setup instructions form the first part of assignment 1, but >>>&= gt;> there will be a bit more yet to come (probably available by Friday = >>>>> afternoon). tml" class=3D"uri">https://liucs.net/cs664s16/a1.html >>>>&= gt; >>>>> CL >>>> >>>> >>>&= gt; >>>> >>>> =E2=80=93 >>>> So many im= migrant groups have swept through our town >>>> that Brooklyn, = like Atlantis, reaches mythological >>>> proportions in the min= d of the world - RI Safir 1998 >>>> http://www.mrbrklyn.com >= ;>>> >>>> DRM is THEFT - We are the STAKEHOLDERS - RI = Safir 2002 >>>> http://www.nylxs.com - Leadership Development i= n Free Software >>>> http://www2.mrbrklyn.com/resources - Unpub= lished Archive >>>> http://www.coinhangout.com - coins! >>= ;>> http://www.brooklyn-living.com >>>> >>>> = Being so tracked is for FARM ANIMALS and and extermination camps, >>&= gt;> but incompatible with living as a free human being. -RI Safir 2013 = >>> >> >> >> =E2=80=93 >> So many immigran= t groups have swept through our town >> that Brooklyn, like Atlantis,= reaches mythological >> proportions in the mind of the world - RI Sa= fir 1998 >> http://www.mrbrklyn.com >> >> DRM is THEFT - = We are the STAKEHOLDERS - RI Safir 2002 >> http://www.nylxs.com - Lea= dership Development in Free Software >> http://www2.mrbrklyn.com/reso= urces - Unpublished Archive >> http://www.coinhangout.com - coins! &g= t;> http://www.brooklyn-living.com >> >> Being so tracked is= for FARM ANIMALS and and extermination camps, >> but incompatible wi= th living as a free human being. -RI Safir 2013 >
=E2=80=93 So many immigrant groups have swept through our town that Broo= klyn, like Atlantis, reaches mythological proportions in the mind of the wo= rld - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.= com - Leadership Development in Free Software http://www2.mrbrklyn.com/reso= urces - Unpublished Archive http://www.coinhangout.com - coins! http://www.= brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but in= compatible with living as a free human being. -RI Safir 2013
--==-=-=--
--=-=-=--
--===-=-= Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2
iQEcBAEBCAAGBQJWonrTAAoJEGuLsz1PMbCLZwoH/2p9TMbJzfrnwuIKLtgCMC+3 E46a/WnsQHOL3EXImA+72kd6gL+pWjZR4EmekSC4U2/79SylCGVlizty5CerOt2z viUp/Ad5YpVEjHEEssAV8yVVL1TesIPzXLPidH+bcoNe0XNdBbdTIpvNmPRcrxag 7AqU3ntGYfSbZ7bEyT1B2il1dlF5g9dHYTitTOLuV/9xn6qShwh1T5yxLzAfs9uc zatv0oh4KTtNaOBBjXkTufm3mOBjwkjHrKwDwrw+hNTIPyeVA2kd8BeWKy81pQQc Tmj8/xcnxhPsFDREOZ4Q6CMdqN1+btmivjIVPm03fzPXmLY8G3v5VMP7QP8bAw0= =8y8i -----END PGP SIGNATURE----- --===-=-=--
--===============0747997716== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
--===============0747997716==--
|
|