This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Pages: 1 - Last Post: 28 Oct 20, 18:06 Last Post By: davidekholm Threads: [ Previous | Next ]
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Command line mode Java error
Posted: 28 Oct 20, 14:06
 
  Click to reply to this thread Reply
Using jAlbum 22.1, I can't use the command line to build albums. My skins now require at least jAlbum 22 and Java 14. If I try to use the command line, I get this:
C:\Users\jefft\xampp\htdocs\aa>java -Xmx1600M -jar "C:\Program Files\jAlbum\JAlbum.jar" -projectFile "jalbum-settings.jap" -appendImages
jAlbum v22.1 started in console mode
java.lang.UnsupportedClassVersionError: The Atom skin requires a more recent Java version)
        at se.datadosen.jalbum.AlbumBean.setDataTypes(AlbumBean.java:5291)
        at se.datadosen.jalbum.AlbumBean.setSkinVariables(AlbumBean.java:5200)
        at se.datadosen.jalbum.AlbumBean.setProperties(AlbumBean.java:5385)
        at se.datadosen.jalbum.AlbumBean.setSkin(AlbumBean.java:4885)
        at se.datadosen.jalbum.JAlbumConsole.<init>(JAlbumConsole.java:78)
        at se.datadosen.jalbum.JAlbum.main(JAlbum.java:323)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at se.datadosen.jalbum.Main.main(Main.java:45)
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 14:08   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
And I think I see why. The JAlbum.jar file in the bundle is dated 5/24/2018.
davidekholm

Posts: 3,462
Registered: 18-Oct-2002
Re: Command line mode Java error
Posted: 28 Oct 20, 14:21   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
What does

java --version

deliver?

The fact that JAlbum.jar hasn't been updated for a while shouldn't matter.
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 14:26   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
It returns this:
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
Remember, I have only JRE 8 installed on my system. I have JDK 15, but there's effectively no JRE 15 available unless you build it yourself.
davidekholm

Posts: 3,462
Registered: 18-Oct-2002
Re: Command line mode Java error
Posted: 28 Oct 20, 14:31   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
It returns this:
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
Remember, I have only JRE 8 installed on my system. I have JDK 15, but there's effectively no JRE 15 available unless you build it yourself.

Ok, but is "Atom" compiled with JDK 8 as SRC/Binary format then? That will be a requirement for that to work.
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 14:31   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
And, as suspected, if I change the command line (I'm actually running this from a .cmd file) to this:
"C:\Program Files\jAlbum\jre64\bin\java.exe" -Xmx1600M -jar "C:\Program Files\jAlbum\JAlbum.jar" -projectFile "jalbum-settings.jap" -appendImages
It works. I'll let Wiki Boy know that the documentation is in serious need of updating, since most users won't have anything beyond JRE 8, if they have Java installed at all.

ETA: I think that regardless of what the user does, or does not have on his machine, when he runs from the command line, he should be using whatever version of Java is bundled with his installed version of jAlbum. The documentation should reflect this.
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 14:32   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
Ok, but is "Atom" compiled with JDK 8 as SRC/Binary format then?

No, I'm compiling to JDK 14 as the Source/Binary.
davidekholm

Posts: 3,462
Registered: 18-Oct-2002
Re: Command line mode Java error
Posted: 28 Oct 20, 14:34   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
davidekholm wrote:
Ok, but is "Atom" compiled with JDK 8 as SRC/Binary format then?

No, I'm compiling to JDK 14 as the Source/Binary.


If you don't rely on JDK14 features, just set the Source/Binary setting to JDK 8. I still use that switch for jAlbum's main code. I don't go lower than JDK 8 though as jAlbum makes heavy use of JDK8's Lambda expressions.
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 14:43   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
But that still doesn't help a command line user who doesn't have even JRE 8 installed. These days, there's no reason for a user to install it. The safe thing to do is not rely on a PATH variable to find Java - just spell it out on the command line.

Oddly, the only reason I have it installed is because the NetBeans installer needs Java, and doesn't know that Java is lurking in the jAlbum program files. The only other Java app that I use, Total Validator, switched to bundling Java a while back because of the changed licensing issues.
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 15:08   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Odd, however, that I did not see this error when I was compiling my skins to JDK 11 or JDK 13. Using JRE 8 from the command line still worked. This has shown up only when compiling to JDK 14.

In any event, this presents a conundrum, since there are multiple ways to address this. Recompile the skins to JDK 8? Or batch edit my command files to point to jAlbum's java.exe? Or tinker with the Windows PATH variable? Something to mull over....
JeffTucker

Posts: 8,208
Registered: 31-Jan-2006
Re: Command line mode Java error
Posted: 28 Oct 20, 15:53   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I believe I've cracked this little mystery, and it all goes back to the Windows PATH variable. jAlbum adds its own element to that variable, pointing to its jre64/bin directory, which is where the Java executable is lurking. So far, so good. But if you then install JRE 8 (for whatever reason), it places its own element in the PATH variable, before the others. So, when the command line goes out looking for Java, the first one it finds is JRE 8.

The fix is either to uninstall JRE 8 (which most users don't need for anything, anyway), or to head into the Windows control panel and change the order of the PATH variable elements.
davidekholm

Posts: 3,462
Registered: 18-Oct-2002
Re: Command line mode Java error
Posted: 28 Oct 20, 18:06   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Great :-)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums