Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39454 > unrolled thread
| Started by | Jeff Higgins <invalid@invalid.org> |
|---|---|
| First post | 2020-04-26 05:06 -0400 |
| Last post | 2020-04-27 09:46 -0400 |
| Articles | 10 — 5 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Surprise! Jeff Higgins <invalid@invalid.org> - 2020-04-26 05:06 -0400
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-26 13:00 +0000
Re: Surprise! Joerg Meier <joergmmeier@arcor.de> - 2020-04-27 09:13 +0200
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-27 12:12 +0000
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 08:34 -0400
Re: Surprise! Martin Gregorie <martin@mydomain.invalid> - 2020-04-27 13:52 +0000
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 10:04 -0400
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 10:09 -0400
Re: Surprise! Eric Douglas <e.d.programmer@gmail.com> - 2020-04-27 06:36 -0700
Re: Surprise! Arne Vajhøj <arne@vajhoej.dk> - 2020-04-27 09:46 -0400
| From | Jeff Higgins <invalid@invalid.org> |
|---|---|
| Date | 2020-04-26 05:06 -0400 |
| Subject | Re: Surprise! |
| Message-ID | <r83j0k$f1$1@dont-email.me> |
On 9/19/19 3:28 PM, Stefan Ram wrote:
> Write this:
>
> public final class A
> { public static void main( final java.lang.String[] args )
> { B.hello(); }}
>
> public final class B
> { public static void hello()
> { java.lang.System.out.println( "Hello!" ); }}
>
> and save it as "Main.java". Then call:
>
> java Main.java
>
> with a recent JDK. What you have there is a file named
> "Main.java" that does /not/ contain a class "Main", and
> it has /two/ public classes. Yet, the above command will
> happily print,
>
> Hello!
>
> .
>
>
https://docs.oracle.com/en/java/javase/14/docs/specs/man/java.html#using-source-file-mode-to-launch-single-file-source-code-programs
[toc] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2020-04-26 13:00 +0000 |
| Message-ID | <r840l4$ius$1@dont-email.me> |
| In reply to | #39454 |
On Sun, 26 Apr 2020 05:06:48 -0400, Jeff Higgins wrote:
> On 9/19/19 3:28 PM, Stefan Ram wrote:
>> Write this:
>>
>> public final class A { public static void main( final
>> java.lang.String[] args )
>> { B.hello(); }}
>>
>> public final class B { public static void hello()
>> { java.lang.System.out.println( "Hello!" ); }}
>>
>> and save it as "Main.java". Then call:
>>
>> java Main.java
>>
>> with a recent JDK. What you have there is a file named "Main.java"
>> that does /not/ contain a class "Main", and it has /two/ public
>> classes. Yet, the above command will happily print,
>>
Not here. I rearranged your source because I prefer opening and closing
brackets to align. Here's the result:
$ cat Main.java
public final class A
{
public static void main( final java.lang.String[] args )
{
B.hello();
}
}
public final class B
{
public static void hello()
{
java.lang.System.out.println( "Hello!" );
}
}
$ javac -version
javac 1.8.0_242
$ javac Main.java
Main.java:1: error: class A is public, should be declared in a file named
A.java
public final class A
^
Main.java:9: error: class B is public, should be declared in a file named
B.java
public final class B
^
2 errors
This is using Open Java 1.8 installed from the RedHat Fedora 31 package
repository and is exactly what I'd expect to see, since the name of a non-
nested class declaration should match the sourcefile name.
--
Martin | martin at
Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Joerg Meier <joergmmeier@arcor.de> |
|---|---|
| Date | 2020-04-27 09:13 +0200 |
| Message-ID | <1t2omfi424j5x.v6vd61lcman0$.dlg@40tude.net> |
| In reply to | #39457 |
On Sun, 26 Apr 2020 13:00:20 -0000 (UTC), Martin Gregorie wrote: > On Sun, 26 Apr 2020 05:06:48 -0400, Jeff Higgins wrote: >> On 9/19/19 3:28 PM, Stefan Ram wrote: >>> [...] with a recent JDK. [...] > This is using Open Java 1.8 [...] Calling 1.8 "recent" is quite a stretch ;) Liebe Gruesse, Joerg -- Ich lese meine Emails nicht, replies to Email bleiben also leider ungelesen.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2020-04-27 12:12 +0000 |
| Message-ID | <r86i86$r3j$1@dont-email.me> |
| In reply to | #39458 |
On Mon, 27 Apr 2020 09:13:59 +0200, Joerg Meier wrote: > On Sun, 26 Apr 2020 13:00:20 -0000 (UTC), Martin Gregorie wrote: > >> On Sun, 26 Apr 2020 05:06:48 -0400, Jeff Higgins wrote: >>> On 9/19/19 3:28 PM, Stefan Ram wrote: >>>> [...] with a recent JDK. [...] > >> This is using Open Java 1.8 [...] > > Calling 1.8 "recent" is quite a stretch ;) > True enough, but AFAIK its still supported, alongside 11 and 14, for Fedora Linux. I recently saw stats (in The Register) showing the majority of developers are still using 8, and #242 is the most recent Java 8 release. If its just as easy to move from Java 8 to 11 or 14 as it still is to compile a K&R source file under that latest ANSI C compiler, then I'm happy to move on, but is it that easy? Somehow I've gotten the impression that it may not be. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-04-27 08:34 -0400 |
| Message-ID | <r86jgr$1lmt$1@gioia.aioe.org> |
| In reply to | #39459 |
On 4/27/2020 8:12 AM, Martin Gregorie wrote: > On Mon, 27 Apr 2020 09:13:59 +0200, Joerg Meier wrote: >> On Sun, 26 Apr 2020 13:00:20 -0000 (UTC), Martin Gregorie wrote: >>> On Sun, 26 Apr 2020 05:06:48 -0400, Jeff Higgins wrote: >>>> On 9/19/19 3:28 PM, Stefan Ram wrote: >>>>> [...] with a recent JDK. [...] >> >>> This is using Open Java 1.8 [...] >> >> Calling 1.8 "recent" is quite a stretch ;) >> > True enough, but AFAIK its still supported, alongside 11 and 14, for > Fedora Linux. Yes. AdoptOpenJDK will supply updates until May 2026. https://adoptopenjdk.net/support.html > I recently saw stats (in The Register) showing the majority > of developers are still using 8, Yes. But a lot of them are in the process of upgrading to 11 now. > If its just as easy to move from Java 8 to 11 or 14 as it still is to > compile a K&R source file under that latest ANSI C compiler, then I'm > happy to move on, but is it that easy? Somehow I've gotten the impression > that it may not be. Java upgrades are usually pretty easy. But some can cause a bit of work. 1.4 -> 1.5 was one of them. 8 -> 11 is one of them. Things to be aware of include: * if you use unsupported SUN classes then you may need ti circumvent the module system introduced in Java 9 to get your stuff to build and run * if you use JAX-WS or JAXB then that is now a separate download - it is no longer builtin Java SE * if you use JavaFX then that is now a separate download - it is no longer builtin Java SE * if you use CORBA then you need to find another implementation But if you get JAX-WS and JAXB then my guess is that 99.8% of all Java 8 code will work with 11. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2020-04-27 13:52 +0000 |
| Message-ID | <r86o3o$5eb$1@dont-email.me> |
| In reply to | #39460 |
On Mon, 27 Apr 2020 08:34:35 -0400, Arne Vajhøj wrote: > On 4/27/2020 8:12 AM, Martin Gregorie wrote: >> On Mon, 27 Apr 2020 09:13:59 +0200, Joerg Meier wrote: >>> On Sun, 26 Apr 2020 13:00:20 -0000 (UTC), Martin Gregorie wrote: >>>> On Sun, 26 Apr 2020 05:06:48 -0400, Jeff Higgins wrote: >>>>> On 9/19/19 3:28 PM, Stefan Ram wrote: >>>>>> [...] with a recent JDK. [...] >>> >>>> This is using Open Java 1.8 [...] >>> >>> Calling 1.8 "recent" is quite a stretch ;) >>> >> True enough, but AFAIK its still supported, alongside 11 and 14, for >> Fedora Linux. > > Yes. AdoptOpenJDK will supply updates until May 2026. > > https://adoptopenjdk.net/support.html > >> I recently saw stats (in The Register) showing the majority >> of developers are still using 8, > > Yes. But a lot of them are in the process of upgrading to 11 now. > >> If its just as easy to move from Java 8 to 11 or 14 as it still is to >> compile a K&R source file under that latest ANSI C compiler, then I'm >> happy to move on, but is it that easy? Somehow I've gotten the >> impression that it may not be. > > Java upgrades are usually pretty easy. > > But some can cause a bit of work. > > 1.4 -> 1.5 was one of them. > > 8 -> 11 is one of them. > > Things to be aware of include: > * if you use unsupported SUN classes then you may need ti > circumvent the module system introduced in Java 9 to get your stuff > to build and run > * if you use JAX-WS or JAXB then that is now a > separate download - it is no longer builtin Java SE > * if you use JavaFX then that is now a > separate download - it is no longer builtin Java SE > * if you use CORBA then you need to find > another implementation > > But if you get JAX-WS and JAXB then my guess is that 99.8% of all Java 8 > code will work with 11. > Thanks, Arne. I don't use any of the gotchas you mention - nothing, really, outside the what was in the 1.6 standard library, apart from some 3rd party stuff: - the Coco/R syntax generator - RiverLayout, - a geodesy package, - dnsjava, - mail stuff (jaf ?, javamail, mstor) - jcharset - jdbc for PostgreSQL so it looks as though the move should be straight forward. -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-04-27 10:04 -0400 |
| Message-ID | <r86oqa$jbu$1@gioia.aioe.org> |
| In reply to | #39463 |
On 4/27/2020 9:52 AM, Martin Gregorie wrote: > On Mon, 27 Apr 2020 08:34:35 -0400, Arne Vajhøj wrote: >> On 4/27/2020 8:12 AM, Martin Gregorie wrote: >>> If its just as easy to move from Java 8 to 11 or 14 as it still is to >>> compile a K&R source file under that latest ANSI C compiler, then I'm >>> happy to move on, but is it that easy? Somehow I've gotten the >>> impression that it may not be. >> >> Java upgrades are usually pretty easy. >> >> But some can cause a bit of work. >> >> 1.4 -> 1.5 was one of them. >> >> 8 -> 11 is one of them. >> >> Things to be aware of include: >> * if you use unsupported SUN classes then you may need ti >> circumvent the module system introduced in Java 9 to get your stuff >> to build and run >> * if you use JAX-WS or JAXB then that is now a >> separate download - it is no longer builtin Java SE >> * if you use JavaFX then that is now a >> separate download - it is no longer builtin Java SE >> * if you use CORBA then you need to find >> another implementation >> >> But if you get JAX-WS and JAXB then my guess is that 99.8% of all Java 8 >> code will work with 11. > > I don't use any of the gotchas you mention - nothing, really, outside the > what was in the 1.6 standard library, apart from some 3rd party stuff: > > - the Coco/R syntax generator > - RiverLayout, > - a geodesy package, > - dnsjava, > - mail stuff (jaf ?, javamail, mstor) > - jcharset > - jdbc for PostgreSQL > > so it looks as though the move should be straight forward. Give it a try. :-) Arne
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-04-27 10:09 -0400 |
| Message-ID | <r86p22$n0n$1@gioia.aioe.org> |
| In reply to | #39460 |
On 4/27/2020 8:34 AM, Arne Vajhøj wrote:
> 8 -> 11 is one of them.
>
> Things to be aware of include:
> * if you use unsupported SUN classes then you may need ti
> circumvent the module system introduced in Java 9 to
> get your stuff to build and run
> * if you use JAX-WS or JAXB then that is now a
> separate download - it is no longer builtin
> Java SE
> * if you use JavaFX then that is now a
> separate download - it is no longer builtin
> Java SE
> * if you use CORBA then you need to find
> another implementation
>
> But if you get JAX-WS and JAXB then my guess is that 99.8% of all
> Java 8 code will work with 11.
They did try to avoid breaking things.
This code actually works:
public class NewStuff {
public static void main(String[] args) {
int var = 123;
var i = 456;
System.out.println(var + i);
}
}
Arne
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2020-04-27 06:36 -0700 |
| Message-ID | <fff38e82-59a6-4fae-b5c7-dce6edc792e0@googlegroups.com> |
| In reply to | #39459 |
On Monday, April 27, 2020 at 8:13:04 AM UTC-4, Martin Gregorie wrote: > > Calling 1.8 "recent" is quite a stretch ;) > > > True enough, but AFAIK its still supported, alongside 11 and 14, for > Fedora Linux. I recently saw stats (in The Register) showing the majority > of developers are still using 8, and #242 is the most recent Java 8 > release. > > If its just as easy to move from Java 8 to 11 or 14 as it still is to > compile a K&R source file under that latest ANSI C compiler, then I'm > happy to move on, but is it that easy? Somehow I've gotten the impression > that it may not be. > > > -- > Martin | martin at > Gregorie | gregorie dot org I'm using 8 right now. It is easy enough to move from 8 to 11 (when is the next LTS?) but getting government approval?
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2020-04-27 09:46 -0400 |
| Message-ID | <r86nog$o1$1@gioia.aioe.org> |
| In reply to | #39461 |
On 4/27/2020 9:36 AM, Eric Douglas wrote: > On Monday, April 27, 2020 at 8:13:04 AM UTC-4, Martin Gregorie wrote: >>> Calling 1.8 "recent" is quite a stretch ;) >>> >> True enough, but AFAIK its still supported, alongside 11 and 14, for >> Fedora Linux. I recently saw stats (in The Register) showing the majority >> of developers are still using 8, and #242 is the most recent Java 8 >> release. >> >> If its just as easy to move from Java 8 to 11 or 14 as it still is to >> compile a K&R source file under that latest ANSI C compiler, then I'm >> happy to move on, but is it that easy? Somehow I've gotten the impression >> that it may not be. > > I'm using 8 right now. It is easy enough to move from 8 to 11 (when is the next LTS?) but getting government approval? It has changed a bit, but right now my understanding is that 17 (September 2021) will be next LTS. Arne
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web