I have an installer application I am building in javafx but I can't figure out how to get the operating system it is running on so I can place files in the right locations for each system and so I can customize the interface for each. If anyone has any ideas or knows of a website that I can go to for help that would be great. I already tried oracle I could not find anything on ther but if you find a specific page please let me know. Thanks.

Recommended Answers

All 2 Replies

Nobody else has answered so, despite the fact that I've never actually done this myself, there's nothing to lose by having a go!
The doc says that JavaFX can use Java classes, so in theory you should just be able to call the Java System.getProperty(p); // where p is "os.name", "os.version" etc. Even if you can't. for some reason access System directly like that you should be able to create a tiny Java class of your own that just wraps those calls, and use that from JavaFX
If this is rubbish, please just ignore it.

ps Just looked a bit further and it looks like you just have to import java.lang.System; and you're good to go.

pps: public class javafx.lang.FX also seems to support public static java.lang.String getProperty(java.lang.String key)

That did it. I did not know that you could use regular java classes inside JavaFX since it is a scripting language. If you don't mind can you tell me how to )download files from the web, create folders on the system and place the downloaded files into the folder) in my other thread (How do I build an installer in JavaFX?). Any help you can offer would be great thanks.


Thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.