|
There are three system properties which give you the information:
os.name
os.version
os.arch
The problem is that there is no standard defined list: different JVM implementations can return different values for these properties as long as they are consistent for the same JVM on the same operating system. Not only that, prior to Java 1.6 u14, the Sun hotspot JVM reported Windows 7 as being Windows Vista version 6.1 and then subsequent releases changed to Windows 7 version 6.1, so anyone who relied on this and upgraded from u14 to a later release suddenly found their code was behaving differently after a so-called "minor" upgrade.
So I would treat these system properties with a certain amount of caution. It might be good enough, though, if all you need to know is "it's not Windows".
|
|
|
|
|
At least for the code I create all of those situations would have required that the apps be certified for the target platform anyways.
But one solution presents itself if it is an issue. Use a configurable source which allows one to map os/vm values to application values.
|
|
|
|
|
Also the reason why I prefer to bundle a Java runtime with the app rather than relying on whatever random version of Java happens to be installed on the customer's machine. That makes it more predictable and easier to control.
I think (can't guarantee this, but I believe it to be true) that the os.name for Windows on the hotspot JVM can be relied on to start with "Windows" (although some versions may report Windows XP as being Windows 2000, and some report Windows 7 as being Windows Vista). Last time I used the JRockit JVM (about 3 years ago) that was the same. And as far as I am aware, different flavours of Linux all start with "Linux". So if that's all you need to know, that should probably be OK. I can't think of a reason why you would want to know that you are running on Ubuntu release 10.04 with Linux kernel 2.6.32 but who knows, I'm sure somebody somewhere has had that requirement in the past.
|
|
|
|
|
I want ajax popup controll using login screen,
please help me...
|
|
|
|
|
|
hi there i am trying write a function that checks if a string contains punctuation characters like %,&,!. because i dont want to user enter an invalid name last_name so i want check the string.
|
|
|
|
|
A quick Google search finds this page[^].
Unrequited desire is character building.
|
|
|
|
|
well yes i know this class but i guess there arent any specific functions which they check specific characters. as you see in the link http://cplusplus.com/reference/clibrary/cctype/ there are several functions. but in java i can't check a string contains only alphabetic characters_?
|
|
|
|
|
You can do this using regular expressions. A google search for "java regular expression" will give you some good links.
|
|
|
|
|
thanks mate i will try it then : )
|
|
|
|
|
The Java functions mirror the same functions in C and cover most of what you need.
Unrequited desire is character building.
|
|
|
|
|
quartaela wrote: because i dont want to user enter an invalid name last_name
How exactly did you determine that such characters would be invalid in the name?
Or more specifically is this a business requirement?
And what exactly do you think the business process will be if someones legal names does have one of the characters that you excluded?
|
|
|
|
|
hey sorry for late answer : ). nope this is not a business requirement only a little work. so i mean you can not use "!+^%.." characters in name. for exmaple "Pe&%ter".
|
|
|
|
|
i think we don't have ispunct,isspace methods in java,if you observe JAVA API you may get clarity.If you know exactly please keep sample code in site along related documentation.
|
|
|
|
|
Hello,
How to pass data (like string) from applet to web page client code? that is to value parameter of a label (or asp label).
Is it possible to change the value of <param .../> (member of <applet> tag) from applet?
Is it possible to do it without javascript?
Thanks.
|
|
|
|
|
Hi,
http://www.cafeaulait.org/course/week5/16.html
http://web-design.lovetoknow.com/Javascript_Applet_Communication
http://bytes.com/topic/javascript/answers/89259-novice-question-regarding-passing-parameters-javascript-applet
|
|
|
|
|
No! I need to pass data from applet to a webpage (to html control) and not from page to applet. Or I need to make any change in webpage from applet that can be detected with a script.
So what I need is to make the webpage know when the applet finishes its function operations/work.
|
|
|
|
|
If the applet is signed I believe you can execute a javascript function from within the applet using the showDocument and provide it a link like:
showDocument(new URL("javascript:myCallback()");
|
|
|
|
|
Hi,
http://download.oracle.com/javase/tutorial/deployment/applet/invokingAppletMethodsFromJavaScript.html
|
|
|
|
|
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d9ac0c6, pid=1972, tid=932
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing windows-x86)
# Problematic frame:
# V [jvm.dll+0x13c0c6]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x02aac800): VMThread [stack: 0x02b90000,0x02be0000] [id=932]
......................and it goes on to give a lot of other data.
How do I interpret it?
|
|
|
|
|
kartikdasani wrote: # If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
That seems a fairly clear piece of advice. Unless you have the source code of the JVM I would suspect there is not much in the dump that will make a lot of sense.
The best things in life are not things.
|
|
|
|
|
Your runtime crashed. That's bad - really bad, not to say ugly.
Is it happening in a project you're working on? That's a really bad thing if this happens - you need to find the failure.
Somebody / something throws a RuntimeException[^].
You need to find the fail.
EDIT: Crosspost -> getTopWindows() causes runtime crash[^]
regards Torsten
I never finish anyth...
|
|
|
|
|
You are using the 32 bit VM.
The MOST likely cause of that problem is JNI code or a third party library that uses JNI code.
Probably 95% of all occurences is due to that.
Other than the next most likely cause is your environment. Something 'odd'. Such as some unusual firewall, patches, etc.
|
|
|
|
|
Exercise 12.4: A predicate is a boolean-valued function with one parameter. Some languages use predicates in generic programming. Java doesn't, but this exercise looks at how predicates might work in Java.
In Java, we could use "predicate objects" by defining an interface:
public interface Predicate {
public boolean test(Object obj);
}
The idea is that an object that implements this interface knows how to "test" objects in some way. Define a class Predicates that contains the following generic methods for working with predicate objects:
public static void remove(Collection coll, Predicate pred)
// Remove every object, obj, from coll for which
// pred.test(obj) is true.
public static void retain(Collection coll, Predicate pred)
// Remove every object, obj, from coll for which
// pred.test(obj) is false. (That is, retain the
// objects for which the predicate is true.)
public static List collect(Collection coll, Predicate pred)
// Return a List that contains all the objects, obj,
// from the collection, coll, such that pred.test(obj)
// is true.
public static int find(ArrayList list, Predicate pred)
// Return the index of the first item in list
// for which the predicate is true, if any.
// If there is no such item, return -1.
to See The Solution ---> http://www.java2s.clanteam.com/c12/ex-12-4-answer.html
(In C++, methods similar to these are included as a standard part of the generic programming framework.)
|
|
|
|
|
I want to make an applet to make a desktop short cut to a website. I was thinking have java execute a batch file that does the actual creation. I have no idea how to call the batch file. Any guidance would be appreciated!
|
|
|
|