HP-UX Java™ - Java™ On HP-UX 11.0 & 11i Frequently Asked Questions

» Back to Java™ core documentation
Table of contents
»

Product questions

» Q: Does a 64-bit JDK for Windows or for Linux running on IA64 exist?
» Q: Your 1.4 distribution includes both Itanium and PA-RISC JRE's, making it VERY large. We would like to split off the files not needed, for example on PA-RISC systmems, we would like to remove the Itanium files, and vice versa.
» Q: When will HP be discontinuing the SDK/RTE 1.4.1 release line?
» Q: When will HP be discontinuing the 1.2.2 release line?
» Q: How do I tell what version of Java™ I'm running?
» Q: Can I run multiple versions of Java™ at the same time?
» Q: Where can I find more about performance tuning Java™ on HP-UX 11i?
» Q: What versions of Java™ are supported on HP-UX 11i v.1?
» Q: Is Java™ 2 supported on HP-UX 10.20?
» Q: How do HP's version numbers for Java™ compare with JavaSoft's versioning scheme?
» Q: How can I find out the latest bug fixes and most common bugs?
» Q: What was the first Year 2000 compliant release of the HP-UX Developer's Kit for Java?
» Q: What is the best way for me to determine what patches I need to use?
» Q: Are Java™ development tools released by HP at the same time they are released by Sun Microsystems?
» Q: How do I tell the latest version of Java™ available?
» Q: Where could I find additional FAQs about Java?
»

Technical questions

» Q: How can I break the HotSpot 3.5 GB maximum heap size barrier?
» Q: I am running Java™ code on an HP-UX 11.0 machine with 256MB RAM, and it dies after about 55 threads, whereas running it on a Windows system, it hasn't died yet. Is thread contention a lot more expensive on HP-UX machines?
» Q: How can I exclude a method from HotSpot compilation?
» Q: What is the maximum method code size for a Java™ class?
» Q: What is the limit of the number of classes that can be loaded?
» Q: What mechanism causes classes to be unloaded by the JVM?
» Q: Is there a way to know the value of maximum stack size consumed?
» Q: Does Java™ provide a way to catch signals?
» Q: What is the range of priorities offered by SCHED_TIMESHARE policy, and how is Java™ priority level mapped to them?
» Q: Where can I see learn more about JDBC?
» Q: Where can I get examples of JNI functions using parameters?
» Q: Can I use RSA signed applets with the Java™ Plug-in on HP-UX?
»

Troubleshooting questions

» Q: When I run swlist -f sdk14_14207_1100.depot I get the following error message: ERROR: Could not read input file "sdk14_14207_1100.depot" ERROR: Command line parsing failed
» Q: I would like to find out more about the garbage collection mechanism and need further information to understand the result of the log file generated with the "-Xverbosegc" option.
» Q: My application runs a monthly batch job. The job completes successfully for smaller numbers of records, but the process runs out of memory when it encounters records in excess of 100000. What probable location should I start looking at for debugging?
» Q: Are gdb's capabilities for debugging Java™ documented anywhere?
» Q: I have set java -Djava.rmi.server.logCalls=true, and also the system property java.rmi.serever.logCalls to true, and I do not see the log files on the machine.
» Q: I have been unsuccessful in getting my shared library to load. I discovered using "ldd" that there were numerous unsolved symbols in the Java™ library. Running ldd on libjawt.sl indicates unresolved symbols. The symbol entry points appear to be located in libmawt.sl but this library is not linked with libjawt.sl.
» Q: Our application is leaking threads. I notice that when I tune up maxdsize from the default 64MB to 1GB, the thread issue disappears. Is this possible?
» Q: I can load a library from Java™ using LoadsLibrary, but when my Java™ class is initiated from a C++ main (nonjavacallingjava), I receive an error:
» Q: I downloaded Java™ and got the error: "Unable to initialize threads—cannot find class java/lang/thread". What should I do?
» Q: I'm trying to establish a bare socket connection from a client machine to a server machine on another network through a firewall. How do I do this?
» Q: On HP-UX 10.20, when I start swinstall and try to install the depot file, I get the message: "You do not have the required permissions to perform this SD operation." How can this be, if I am logged in as root?
» Q: I have a program with many threads, and I suspect there is some lock contention between the threads which is slowing down the performance. Can you recommend a tool which will help me identify potential lock contentions?

Product questions

Q: Does a 64-bit JDK for Windows or for Linux running on IA64 exist??

A: HP does not support Windows or Linux on Itanium. The recommended solution is BEA's WebLogic JRockit™ JVM.

Q: Your 1.4 distribution includes both Itanium and PA-RISC JRE's, making it VERY large. We would like to split off the files not needed, for example on PA-RISC systmems, we would like to remove the Itanium files, and vice versa.

A: Beginning with version 1.4.2.05 and later, you may remove support for unwanted architectures. Functional components may NOT be removed under any circumstances. For instructions on how to remove the unwanted files, refer to the HP-UX Java™ release notes for each SDK. This functionality is NOT available in 1.3 releases, or in 1.4.2.00 through 1.4.2.04 releases.

Q: When will HP be discontinuing the SDK/RTE 1.4.1 release line?

A: HP's 1.4.1 release line was discontinued on June 30, 2004. This is consistent with Sun Microsystems' end of life policy documented at "Sun Java™ Technology EOL Policy". We highly recommend that you migrate to our latest JDK 5.0 or SDK 1.4.2 release.

Q: When will HP be discontinuing the 1.2.2 release line?

A: HP discontinued the 1.2.2 release line when 5.0 was released in December 2004. This is consistent with Sun Microsystems' end of life policy documented at "Sun Java™ Technology EOL Policy". We highly recommend that you migrate to our latest SDK 1.4.2 release or JDK 5.0.

Q: How do I tell what version of Java™ I'm running?

A: Assuming the directory where Java™ is installed is in your PATH variable, run

java -version

Alternatively you can use the full path name. If you have installed in the default location, the paths are as follows:

Java™ 1.3 /opt/java1.3
Java™ 1.4 /opt/java1.4
Java™ 5.0 /opt/java1.5

The java -version command also gives you the specific release information, such as the build date and all the minor version information. For a more detailed explanation of the ouput, see "Determining Your Java™ Version".

Q: Can I run multiple versions of Java™ at the same time?

A: Yes, because each version installs by default into a different directory. Java™ 1.3 installs in opt/java1.3, Java™ 1.4 in /opt/java1.4, and Java™ 5.0 in /opt/java1.5.

However you need to add the correct directory for the version you are using to your PATH variable.

For JNI applications, you also need to define the environment variable SHLIB_PATH to reference the correct directory structure for the Java™ shared libraries.

Q: Where can I find more about performance tuning Java™ on HP-UX 11i?

A: Please go to our Java™ performance tuning website which has a collection of tips, tools and techniques for helping you improve performance.

Q: What versions of Java™ are supported on HP-UX 11i v.1?

SDK/RTE 1.2.2.04h or greater, SDK/RTE 1.3.1.x, SDK/RTE 1.4.x, and SDK/RTE 5.0 are supported on HP-UX 11i v.1. However, because we provide Java™ bug fixes via update releases and not via individual bug fix patches, we recommend that you always install the latest Java™ version.

Q: Is Java™ 2 supported on HP-UX 10.20?

A: Java™ 2 is not supported on HP-UX 10.20. HP decided not to productize Java™ 2 for HP-UX 10.20 because HP-UX 10.20 does not include kernel threads. The lack of kernel threads seriously impacts Java™ application performance on HP-UX 10.20.

Q: How do HP's version numbers for Java™ compare with JavaSoft's versioning scheme?

A: HP's product versioning scheme is similar to Sun Microsystems' versioning scheme. An HP maintenance release, for example 1.4.1.00, would contain Sun's 1.4.1 maintenance fixes and may include additional HP defect fixes. A subsequent HP maintenance release, for example 1.4.1.03, would contain all additional defect fixes for HP releases after 1.4.1.00. HP's maintenance releases are not directly comparable to Sun's update releases. For example, HP's 1.4.1.03 is not directly comparable to Sun's 1.4.1_03. For more details, refer to End of life policy and release naming terminology.

Q: How can I find out the latest bug fixes and most common bugs?

A: For Sun Microsystems' defect fixes, go to their "Source for Developers" website at http://java.sun.com/. For HP's defect fixes, go to Defect information by release.

Q: What was the first Year 2000 compliant release of the HP-UX Developer's Kit for Java?

A: Release 1.1.6. For further information, see Y2K status.

Q: What is the best way for me to determine what patches I need to use?

A: The best way to keep up-to-date is to refer to our patch information web site, which is updated regularly.

Q: Are Java™ development tools released by HP at the same time they are released by Sun Microsystems?

A: We are a licensee of Java™ from Sun, and as such, must wait for them to provide code to us for our porting and tuning.

Q: How do I tell the latest version of Java™ available?

A: The best way is to go the HP-UX Java™ downloads page, where you will see the most current releases.

Q: Where could I find additional FAQs about Java?

A: You could try the following websites: www.jguru.com/faq and Sun Microsystems' ""Source for Developers" website at http://java.sun.com.

Technical questions

Q: How can I break the HotSpot 3.5 GB maximum heap size barrier?

A: The best way to do this is to use our 64-bit binaries to get past the heap size limitations. You do this by adding the "-d64" option to the command line. Java™ options are documented in the HotSpot chapter in the Java™ for HP-UX Programmer's Guide.

Q: I am running Java™ code on an HP-UX 11.0 machine with 256MB RAM, and it dies after about 55 threads, whereas running it on a Windows system, it hasn't died yet. Is thread contention a lot more expensive on HP-UX machines?

A: You need to modify your kernel parameters. The max_thread_proc parameter defines the maximum number of kernel threads allowed per process. On 11.0 the default is set to 64, and your 55 threads plus the threads in the JVM are trying to exceed this. Use HPjconfig (freely available from HPjconfig on SW Depot) to set your kernel parameters to optimal values for Java™.

Q: How can I exclude a method from HotSpot compilation?

A: Create a file in the home directory where the Java™ application will be started, name it .hotspot_compiler and include entries describing the method(s) to exclude in the form of:

exclude class_name method_name

for example

exclude hpdocs/com/bean/PersistentBean addInnerPersistentFields

For more information on excluding methods, refer to the Java™ for HP-UX Programmer's Guide at HotSpot chapter in HP-UX Programmer's Guide

Q: What is the maximum method code size for a Java™ class?

A: Currently, the JVM specification remains at 64K for max bytecode size of a method. There are currently no plans to increase this by JavaSoft.

Q: What is the limit of the number of classes that can be loaded?

A: There is no limit to the number of classes that can be loaded other than memory. Class definitions are loaded into the PermSpace by the class loader. When the PermSpace fills up you will begin to get OutOfMemoryError exceptions. You can make the PermSpace larger by using the -XX:MaxPermSize=<value>. The default is 64MB. Prior to making a change, it may be a good idea to run with -Xverbosegc and use HPjtune to observe the use of the Permanent space. Refer also to the Java™ Programmer's Guide for HP-UX

Q: What mechanism causes classes to be unloaded by the JVM?

A: When a class is referenced (i.e. with a new statement) for the first time, the class definition is loaded using either the default class loader or a custom one if you've defined one. The class definition is stored in an area of the Java™ heap called the Perm Space. All allocated instances of that class definition have a reference back to the reference stored in the Perm Space. When there are no longer any class instances that reference that class definition, the definition becomes a candidate for collection. The next time a full garbage collection takes place, all class definitions in the Perm Space that aren't referenced by any actual instances will be cleaned up or unloaded. One way to trigger a full garbage collection is if the Perm Space fills up. This can be seen by watching the output of -Xverbosegc and looking for the cause of GC.

Q: Is there a way to know the value of maximum stack size consumed?

A: There isn't a straightforward way to do this, however, there is a way using HP OpenView GlancePlus. GlancePlus has a function that reports the memory utilization for various parts of the memory mapped regions. First isolate the regions allocated for the individual threads by looking for regions whose VSS value matches the value currently defined for -Xss. Once found, look at the values of the RSS for these regions and you can get a picture of what each thread is consuming. If you don't have too many threads, you should be able to find out quickly the largest thread stack utilization. You could possibly write a script to process this information.

Q: Does Java™ provide a way to catch signals?

A: No, Java™ doesn't have any model for a signal in the virtual machine. The JVM uses signals internally for its operation and so native methods should generally avoid attempting to send signals or install handlers for signals. In a simple case such as catching a CNTL C and doing a cleanup, you could launch Java™ from within a Perl script. The Perl script can catch the CNTL C and then signal the JVM by writing to a socket. The application needs to be written so that it is listening on that socket for the signal.

Q: What is the range of priorities offered by SCHED_TIMESHARE policy, and how is Java™ priority level mapped to them?

A: This applies to the native-threaded JVM but not to the green-threaded JVM. In the native-threaded JVM, we basically map the range (java.lang.Thread.MIN_PRIORITY-1..java.lang.Thread.MAX_PRIORITY) to the range determined by calling sched_get_priority_min() and sched_get_priority_max() for the SCHED_OTHER (also known as SCHED_TIMESHARE) policy. However, because non-privileged applications cannot raise the priority of threads, we only do this priority mapping for applications running as users with sufficient privileges to raise priorities or be a member of group PRIV_RTSCHED. For all other applications, the native-threaded JVM effectively ignores the Java™ thread priorities and all native threads are created with identical priorities.

Q: Where can I see learn more about JDBC?

A: See JavaSoft's JDBC™ webpage. and read "JDBC Database Access with Java™" by Graham Hamilton, R.G.G. Cattell, and Maydene Fisher, published by Addison-Wesley.

The reference implementations from Sun are the base for HP's products for Java™. The Solaris implementation from Sun is subjected to additional engineering to give them some additional features, and additional testing to ensure their product's quality.

HP performs the same functions on the Java™ reference implementations that we receive from Sun. Consequently, HP and other licensees have the opportunity to release their products at the same time as the Solaris product from Sun. In some cases HP has delivered the product before IBM and before Sun's comparable Solaris product and with higher performance (measured by the industry standard SPECjvm98 benchmark) than either Sun or IBM.

Q: Where can I get examples of JNI functions using parameters?

A: See the example on the following web site:

 » Advanced programming for the Java™ 2 platform

Q: Can I use RSA signed applets with the Java™ Plug-in on HP-UX?

A: Version 1.3 and later of the Java™ Plug-in supports RSA signed applets.

Troubleshooting questions

Q: When I run swlist -f sdk14_14207_1100.depot I get the following error message: ERROR: Could not read input file "sdk14_14207_1100.depot" ERROR: Command line parsing failed

A: Try your swlist command with an absolute path to the downloaded .depot file and using the -s flag, as follows:

swlist -s /tmp/sdk14_14207_1100.depot

Q: I would like to find out more about the garbage collection mechanism and need further information to understand the result of the log file generated with the "-Xverbosegc" option.

A: The -Xverbosegc option is explained in detail in the Java™ for HP-UX Programmer's Guide, in the HotSpot chapter at HP-UX Java™ Programmer's Guide. In addition, you could use HPjtune, HP's garbage collection analysis tool, that can be downloaded free from HP-UX Java™ downloads.

Another tool available to you is an awk script that formats the verbosegc output files that you can obtain from HP-UX Java™ downloads, on the Information Library page at: Information Library Core Documents.

To format your gc.out file, just type:

cat gc.out|awk -f vgc > gc.formatted

Q: My application runs a monthly batch job. The job completes successfully for smaller numbers of records, but the process runs out of memory when it encounters records in excess of 100000. What probable location should I start looking at for debugging?

A: There are many things that could cause this. As a start you should use HP OpenView GlancePlus available from http://www.managementsoftware.hp.com/products/a-z.html to find out what area the process runs out of space. If it is Java™ heap, run the profiler and verbosegc to analyze the heap. For more information on verbosegc, refer to the HP-UX Programmer's Guide If the problem is in the C heap (DATA) you may have a memory leak. You can use gdb (available from www.hp.com/go/wdb) to locate the problem.

Q: Are gdb's capabilities for debugging Java™ documented anywhere?

A: You could start with "Debugging a native JNI library with Java™ 2 HotSpot VM under gdb" at Developer & Solution Partner Program (DSPP). Also, stack unwinding in the Java™ code is now available, so you can now do a backtrace through the native code stack frames, interpreter code stack frames, and runtime compiled code stack frames. To use this new feature, you will need the latest version of gdb available from www.hp.com/go/wdb, plus the 1.3.1.02 or later JVM.

Q: I have set java -Djava.rmi.server.logCalls=true, and also the system property java.rmi.serever.logCalls to true, and I do not see the log files on the machine.

A: The logs are sent to standard error. If you have stderr redirected, you need to look there. Also, both options are equivalent, so you need to use either one of the options, but not both.

Q: I have been unsuccessful in getting my shared library to load. I discovered using "ldd" that there were numerous unsolved symbols in the Java™ library. Running ldd on libjawt.sl indicates unresolved symbols. The symbol entry points appear to be located in libmawt.sl but this library is not linked with libjawt.sl

A: The library libmawt.sl is loaded using java.lang.ClassLoader.loadLibrary() during runtime, which resolves the symbols.

Q: Our application is leaking threads. I notice that when I tune up maxdsize from the default 64MB to 1GB, the thread issue disappears. Is this possible?

A: If the maxdsize limit is being reached, then this can cause trouble creating new threads. If a thread creation fails it is reported back to the application as an OutOfMemoryError, usually as a result of a call to Thread.start().

Q: I can load a library from Java™ using LoadsLibrary, but when my Java™ class is initiated from a C++ main (nonjavacallingjava), I receive an error:

shl_load failed for: ./libftjss01.sl,
[errno 2: No such file or directory] /usr/lib/dld.sl:
Call to mmap() failed - TEXT ./libftjss01.sl

A: Ensure that the SHLIB_PATH of the main executable is enabled. Also ensure that the C++ main initializes some Java™ properties (like mx) as follows, for example:

//Get the default initialization args and set the class path
jint ret = JNI_GetDefaultJavaVM InitArgs(vm_args);

vm.args.version = 0x00010001:
vm_args.minHeapSize = 32000000;
vm_args.maxHeapSize = 96000000;
vm_args.nativeStatckSize = 1000000;
vm_args.javaStackSize = 1000000;
vm_args.disableJIT = JNI_TRUE;
if (ret !=0)
  printf("failed to GetDefaultJavaVMInitArgs/n");

//Note: If you have not set and exported the environment variable
//CLASSPATH you may also need to add this:

vm_args.classpath =.:/opt/java/lib/classes.zip:./ssjcls01.zip";

//load and initialize a JVM, return a JNI interface pointer in env
  ret = JNI_CreateJavaVM(jvm env vm_args);

For more information and code examples, refer to the JNI chapter of the HP-UX Java™ Programmer's Guide

Q: I downloaded Java™ and got the error: "Unable to initialize threads -- cannot find class java/lang/thread". What should I do?

A: For most users, the Java™ wrapper script will take care of setting the JAVA_HOME environment variable and will add the appropriate entries to the CLASSPATH so that the JVM finds the standard API classes.

The PATH environment variable needs to include a path to the Java™ wrapper script. People writing applications with non-Java mains may need to worry about the setting of CLASSPATH and SHLIB_PATH.

For more information, refer to the HP-UX Java™ Programmer's Guide

Q: I'm trying to establish a bare socket connection from a client machine to a server machine on another network through a firewall. How do I do this?

A: You have to use C or C++ routines and communicate with the JVM via JNI calls (Java™ calling C or C++). For more information and code examples, refer to the JNI chapter of our Java™ 2 Programmer's Guide at HP-UX Java™ Programmer's Guide

Q: When I start swinstall and try to install the depot file, I get the message: "You do not have the required permissions to perform this SD operation." How can this be, if I am logged in as root?

A: You could try the following:

- Kill the swagentd process.

- Run the following command, and if the file swlock exists, rename the file.

ls /var/adm/sw/products/swlock

- Kill the swinstall process (if swinstall is running).

- Restart the swagentd process.

Q: I have a program with many threads, and I suspect there is some lock contention between the threads which is slowing down the performance. Can you recommend a tool which will help me identify potential lock contentions?

A: Please go to our Java™ performance tuning website, which contains much useful information on helping you improve the performance of your Java-based applications. In particular, look at the "Java™ specific profilers and tools" section of the tools page, which offers a script that you can use in conjunction with the "kill -3 <pid> command. In addition, if you are using the SDK 1.3.1.02 or later, you can use the lock contention metric of HPjmeter to analyze the problem.

Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Hewlett-Packard is independent of Sun Microsystems, Inc.