Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Rob Spoor

Sheriff
+ Follow
since Oct 27, 2005
Rob likes ...
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
Cows and Likes
Cows
Total received
107
In last 30 days
0
Total given
48
Likes
Total received
1614
Received in last 30 days
7
Total given
2369
Given in last 30 days
9
Forums and Threads

Recent posts by Rob Spoor

Tim Holloway wrote:You cannot execute a JAR without a Java runtime program (JVM). An "executable" JAR is one where you can say:


It's java -jar myExecutable.jar. If you use -classpath you must still define the main class in the command.

(I assume the Main is a typo)
5 hours ago

Terrance Samson wrote:How do I decompress/extract the files from that?  Or should I do it in Windows and then just take those extracted files and put them in Java?  Or can I even do it in Windows?


unpack tar.gz. Don't do this on Windows; while some tools can handle them (7-Zip for instance), any Linux installation should come with tar and gzip and therefore should be able to do it.
2 days ago
You should checkout:
* The default close operation for JFrame and JDialog.
* WindowListeners.

With both you can define what happens if you click on the (red) close icon of the window (JFrame, JDialog). The default close operation is HIDE_ON_CLOSE, which means that the JFrame/JDialog will no longer be visible, but it still holds resources. I prefer DISPOSE_ON_CLOSE (not EXIT_ON_CLOSE), as it allows the Event Dispatcher Thread to shutdown correctly once all windows are disposed. EXIT_ON_CLOSE calls System.exit, which terminates all threads immediately.
2 days ago
From https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Deque.html:

The name deque is short for "double ended queue" and is usually pronounced "deck".


Probably to avoid confusion with the noun "dequeue" (de-queue).
4 days ago

Andrew Spiteri wrote:You say var like a pirate saying arrrrrr, and then args, like the beginning of [arg]ument, with an s sound at the end.

varrrrrr-argssssss


You make it sound like a bad pirate joke:

What's a pirate's favourite Java language feature? Varrrrrr aarrrrrrs.
5 days ago

Dave Tolls wrote:Looks like '\' hasn't been encoded.


I'm quoting this because it's still true.
6 days ago
Not many changes in the API: https://robtimus.github.io/whats-new-in-java/. Apart from text blocks being non-experimental I find this release quite underwhelming. But that's the power of releasing every 6 months - some releases you get a lot, some you don't.

Mike Simmons wrote:But I don't see a new certification coming out of this release.


I know that's probably meant as a joke, but Oracle will never do any certification for non-LTS versions like this one.
2 weeks ago
FYI, for Writer, append is little more than an alias for write that's mandated by the Appendable interface (that goes for all three versions). There is null handling, and converting to String, but after that you basically get a write.
2 weeks ago

Tim Holloway wrote:What I would expect to see is that there should be no DLL code in the Java application at all. Because a well-designed JDBC Type 2 Driver should be managing the DLL itself. It's in a far better position to know if/when the DLL should be loaded/unloaded and by keeping the OS-dependent code within itself, helps keep the actual application code more in the ideal Java mode of "write-once/run-anywhere".


Unfortunately we're in MS SQL Server land here. The official MS driver simply needs the DLL for integrated security.

I've actually had this issue last week, with the very latest driver even. The data source was configured in JBoss' standalone.xml, as it should. The application works just fine that way, and JBoss manages the connections. However, trying to do a reload from the JBoss CLI triggered the same error. For me the solution was simple enough - restart JBoss completely, which is almost what the reload would have done.
2 weeks ago

Ron McLeod wrote:For example, on my Windows workstation:
    C:\Users\Ron\AppData\Local
    C:\Users\Ron\AppData\Roaming


You can use System.getenv("LOCALAPPDATA") and System.getenv("APPDATA") to get those values.

Regarding the original issue, if you'd use Path instead of File you would have gotten a clear exception. For instance:

2 weeks ago

Sam Gho wrote:httpd.exe: Syntax error on line 583 of D:/Program Files (x86)/Apache Software Foundation/Apache24/conf/httpd.conf: Cannot load D:/Program Files (x86)/PHP/php5apache2_2.dll into server: %1 is not a valid Win32 application


The php5apache2_2.dll file is written for Apache 2.2, it doesn't work with Apache 2.4. You need php5apache2_4.dll instead. I don't think that PHP 5.3 has that, so you should definitely listen to Tim and upgrade. Apache 5.3 has been EOL for years already; even 5.6 is EOL (I'm not sure what the minimum supported 7.x version is).

There were some breaking changes from 5.6 to 7.0, so if you really don't have the time to fix any errors, at least upgrade to the latest 5.6 version. Otherwise just go for the latest 7.x.

Tim Holloway wrote:The one thing that I really wonder about is that you're using a path with forward slashes to point to your PHP module. While I definitely recommend doing that for Java apps, I'm not sure if Apache will handle that properly. Unless instructions explicitly say not to, I'd try the traditional backslash path style.


That's not a problem, I use that as well.
2 weeks ago
PHP

Tim Holloway wrote:Overall, I don't recommend using Windows Authenitcation on Java database applications. It removes a critical part of database security from the DBA and hands it over to the ActiveDirectory team. And in the case of internal subsystems, requires, I think, that an actual Windows logon ID be constructed for internal functions that might not actually belong to a human being. Not generally a good idea for production servers, since they're expected to run unattended outside of occasional maintenance and control by sysadmins - who should be logging in under personal IDs, not a shared ID if you want happy auditors.


You can setup applications to run under a specific service account. Then this account needs access to the database (but also disk etc). There's no need to use accounts of actual people. In fact, each application can get its own account.

The DBAs can still manage the database security themselves. Not every Windows account can automatically log into SQL Server, and they can grant access as needed. The AD team is only needed to set up the account in AD, the DBAs can do the rest.
3 weeks ago

Frank Mi wrote:Oh, I totally misunderstood it. Because I always see an "OP" asks questions, and a "STAFF" answers them. So I thought "OP" means a new user or non-staff.


According to Naughty By Nature, it stands for Other People. I'll let you find out what the extra P stands for
3 weeks ago

Stephan van Hulst wrote:The problem is caused because you are accessing the database as you are rending the view. After you have rendered each row you close the connection. By the time you press a button, the connection is already closed.


It's even worse. The closing of all the resources occurs within the while loop. So after the first row, everything is closed, and the second row cannot even be retrieved anymore. The clumsy indentation, probably partly caused by the mixing of code and formatting, doesn't help here.