Win a copy of Spring in Action (5th edition) this week in the Spring forum!

Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Forum Moderator
Cows and Likes
Cows
Total received
54
In last 30 days
0
Total given
2
Likes
Total received
933
Received in last 30 days
33
Total given
119
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Norm Radder wrote:The files in this folder are executed when the system starts:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

I have a shortcut to a jar file there.

Seems that this is the System startup, not the login startup.

when I installed Java 11 and uninstalled older versions it broke.


What did they change?  
I've noticed several changes over the years with where a java install places files and what it changes in the windows registry.  I've often had to spend many hours going around fixing what doesn't work with the new install.

They changed the fact that the "javapath" is no longer supported, starting with Java 11.

If you have a shortcut to a jar file, is it run with java.exe or javaw.exe?
8 hours ago
I have a jar file I want to automatically start up when I log in to Windows 10. I had something working many moons ago but when I installed Java 11 and uninstalled older versions it broke.

I don't remember how it got there but in the Windows 10 list of programs to be started automatically there is "Java SE binary" which points to
C:\ProgramData\Oracle\Java\javapath\javaw.exe
which points to
"C:\Program Files\java\jdk 10.0.2\bin\javaw.exe"

Java 10 is the last version to use "javapath". Ideally Id like to use my "JAVA_HOME" environment variable, or, alternatively, be able to update javapath to point to the latest install of Java. The way it is right now I'll always have to keep a copy of Java 10.0.2 installed for this to work.

I also don't remember how I managed to get this startup app to run the jar file. I'm not sure I could do the same thing with another jar file or whether the two would conflict because they both reference the same javaw.exe file.

I wish I'd have written down what I did at the time.  

Seems like I've painted myself into a convoluted corner. I'd like a clearer understanding of how one should approach this with Java 11+. I do have a batch file to run my jar as well but it leaves a bunch of junk on my taskbar and I can't seem to find a way to put a batch file in the list of startup apps.
8 hours ago
Assuming that this is part of your requirements, this calls for an 'if' not a 'switch'. Do you know what the correct range is?
1 day ago
Why do you have 1, 2, and 5 when your requirements state 3, 4, 5?
1 day ago

Daniel Demesmaecker wrote:You can also just place the codetags first and pasted your code between them...

Nice tip. Hadn't thought of that =)
2 days ago
I see you attempted to use the Code tags. For them to work properly you must first have the code highlighted. You can do this by dragging the cursor over the code. If you have a very long block of code then sometimes this doesn't work, so an alternative way to highlight the code is to scroll up to the top of the code and single left click just before the first character, and then scroll down to the end of the code and after the last character do Shift+left click. This should now highlight the code and you can now click on the "Code" button. ALWAYS verify by clicking the "Preview" button at the bottom of the edit window.

I'll fix it for you this  time.
2 days ago
What happens if you rename the file to "x.java" ?
3 days ago
When I google Krasomowca it shows that the 'o' is accented. Is it possible that the file name has this accent?
3 days ago
Type in
javac -version
to see what the computer thinks your version is
3 days ago
Whenever you have compile or run time errors/exceptions, post the complete error message here. There's often useful info in the message.
3 days ago
You are struggling with Scanner and how you expect console input to behave. With console input each data item must be followed by pressing the Enter key. Because Scanner was written to also deal with reading text files they are designed with the ability to put multiple values together on one line. Console input must explicitly forbid this, a task the Scanner was not designed to do.

It is also useful to create some helper methods for console input which encapsulates this concept in order to simplify your application code. Here's an example. The first two promptXXX() methods shouldn't be used but are here so that you can compare their behavior to what you are currently doing.

Note that the constant CONSOLE is created once and used everywhere. Only one Scanner built from System.in should ever be created.
5 days ago
line 6 will leave a pending new-line. You can call nextLine() immediately after that to flush the new-line.
5 days ago
Yes, but to flush out the non-int you could call next() or nextLine(). Different behavior though.
5 days ago
It depends. If someone enters
ABC 42
Of course you want to throw away ABC, but do you also want to throw away the 42 ?
If so then call nextLine().
5 days ago
5 days ago