An I18N bug from java sound should be fixed.

When you try to list some audio related names (such as mix name, port name, control name) by using java sound api, and if the names are writtened by non-ascii character such as Chinese, you will get the strange characters, that means java sound api does not support internationalization character. Here is the sample:
*     SystemMixerFrame.java
* Copyright (c) 2001 - 2002 by Matthias Pfisterer
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.BooleanControl;
import javax.sound.sampled.CompoundControl;
import javax.sound.sampled.Control;
import javax.sound.sampled.EnumControl;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.Port;
IDEAS:
- user setting tab style vs. show complete windows for multiple mixers (horicontal/vertical)
- user setting unix style (L/R volume) vs. windows style (volume/balance)
/**     TODO:
public class TestSystemMixer {
     /**     TODO:
     private static final Port.Info[]     EMPTY_PORT_INFO_ARRAY = new Port.Info[0];
     public static void main(String[] args) {
          new TestSystemMixer();
          System.exit(0);
     /**     TODO:
     public TestSystemMixer()
          List portMixers = getPortMixers();
          if (portMixers.size() == 0) {
               out("There are no mixers that support Port lines.SystemMixer: Error");
               System.exit(1);
          Iterator iterator = portMixers.iterator();
          while (iterator.hasNext())
               Mixer     mixer = (Mixer) iterator.next();
               String     strMixerName = mixer.getMixerInfo().getName();
               out("mixername:" + strMixerName);
               createMixerPanel(mixer);
     /**     Returns the Mixers that support Port lines.
     private List getPortMixers()
          List supportingMixers = new ArrayList();
          Mixer.Info[]     aMixerInfos = AudioSystem.getMixerInfo();
          for (int i = 0; i < aMixerInfos.length; i++)
               Mixer     mixer = AudioSystem.getMixer(aMixerInfos);
               boolean     bSupportsPorts = arePortsSupported(mixer);
               if (bSupportsPorts)
                    supportingMixers.add(mixer);
          return supportingMixers;
     /**     TODO:
     // should be implemented by:
     // Mixer.isLineSupported(new Line.Info(Port.class))
     private boolean arePortsSupported(Mixer mixer)
          Line.Info[]     infos;
          infos = mixer.getSourceLineInfo();
          for (int i = 0; i < infos.length; i++)
               if (infos[i] instanceof Port.Info)
                    return true;
          infos = mixer.getTargetLineInfo();
          for (int i = 0; i < infos.length; i++)
               if (infos[i] instanceof Port.Info)
                    return true;
          return false;
     /**     TODO:
     private void createMixerPanel(Mixer mixer)
          Port.Info[]     infosToCheck = getPortInfo(mixer);
          for (int i = 0; i < infosToCheck.length; i++)
               Port     port = null;
               try
                    port = (Port) mixer.getLine(infosToCheck[i]);
                    port.open();
               catch (LineUnavailableException e)
                    e.printStackTrace();
               if (port != null)
                    createPortPanel(port);
     /**     TODO:
     private Port.Info[] getPortInfo(Mixer mixer)
          Line.Info[]     infos;
          List portInfoList = new ArrayList();
          infos = mixer.getSourceLineInfo();
          for (int i = 0; i < infos.length; i++)
               if (infos[i] instanceof Port.Info)
                    portInfoList.add((Port.Info) infos[i]);
          infos = mixer.getTargetLineInfo();
          for (int i = 0; i < infos.length; i++)
               if (infos[i] instanceof Port.Info)
                    portInfoList.add((Port.Info) infos[i]);
          Port.Info[]     portInfos = (Port.Info[]) portInfoList.toArray(EMPTY_PORT_INFO_ARRAY);
          return portInfos;
     /**     TODO:
     private void createPortPanel(Port port)
          String     strPortName = ((Port.Info) port.getLineInfo()).getName();
          out("Portname:" + strPortName);
          Control[]     aControls = port.getControls();
//          for (int i = 0; i < aControls.length; i++)
          if (aControls.length > 1) {
               // In fact in the windows system, it named SPEAKER port, and it contains play controls.
               out("ignore the port " + strPortName + " that contains more than one control.");
          } else {
               // this is record control.
               out("control:" + aControls[0].toString());
               createControlComponent(aControls[0]);
               if (aControls[0] instanceof FloatControl)
               else
     /**     TODO:
     private void createControlComponent(Control control)
          if (control instanceof BooleanControl)
          String          strControlName = control.getType().toString();
          out("sub control type BooleanControl:" + strControlName);
          else if (control instanceof EnumControl)
          String     strControlName = control.getType().toString();
          out("sub control type EnumControl:" + strControlName);
          System.out.println("WARNING: EnumControl is not yet supported");
          else if (control instanceof FloatControl)
          String     strControlName = control.getType().toString();
          out("sub control type FloatControl:" + strControlName);
          else if (control instanceof CompoundControl)
          String     strControlName = control.getType().toString();
          out("sub control type CompoundControl:" + strControlName);
          Control[]     aControls = ((CompoundControl)control).getMemberControls();
          for (int i = 0; i < aControls.length; i++)
               Control con = aControls[i];
               if (con instanceof BooleanControl) {
                    out("sub sub control type BooleanControl:" + con.getType().toString());
                    if (strControlName.equalsIgnoreCase("Stereo Mix")) {
                         ((BooleanControl) con).setValue(true);
               else if (con instanceof EnumControl) {
                    out("sub sub control type EnumControl:" + con.getType().toString());
               else if (con instanceof FloatControl)
                    if (isBalanceOrPan((FloatControl) con))
                    out("sub sub control type FloatControl balance:" + con.getType().toString());
                    else
                    out("sub sub control type FloatControl pan:" + con.getType().toString());
               else
     /** Returns whether the type of a FloatControl is BALANCE or PAN.
     private static boolean isBalanceOrPan(FloatControl control)
          Control.Type type = control.getType();
          return type.equals(FloatControl.Type.PAN) || type.equals(FloatControl.Type.BALANCE);
     private static void out(String message)
          System.out.println(message);
/*** SystemMixerFrame.java ***/
Compile and run the code below on non-ascii Windows OS, you will catch the problem.
The solution I provide:
Download the jdk 1.4.2 source, search the files named PortMixer.c && PortMixerProvider.c and replace the method "NewStringUTF" with the method below:
jstring WindowsTojstring2( JNIEnv* env, char* str )
jstring rtn = 0;
int slen = strlen(str);
unsigned short* buffer = 0;
if( slen == 0 )
rtn = (*env)->NewStringUTF(env,str );
else
int length = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, NULL, 0 );
buffer = malloc( length*2 + 1 );
if( MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, (LPWSTR)buffer, length ) >0 )
rtn = (*env)->NewString( env, (jchar*)buffer, length );
if( buffer )
free( buffer );
return rtn;
Rebuild jdk source code as per sun build document. Got the result files and pick up jsound.dll, replace the original jsound.dll in your JRE with the fixed file.
Then the problem solved. I also hope sun will fix the problem in the future version of JDK.
Or any one can help me to submit this article to the sun JDK team.
Jiawei Zhang
From Chinese, The city of Shanghai.
MSN: [email protected]

If you only wanted to get a beep you could have used Toolkit.beep
Very simple and fast.
Rommie.

Similar Messages

  • Log File on Desktop From Java HotSpot

    A colleague's PC has a log file on the desktop, created 28th October. Its title: 'hs_err_pid3268.log'
    Initially we were both concerned since Kaspersky had detected some viruses on his machine on it's nightly scan, however, looking at the log file I'm not sure whether to be worried or not! - It looks legitimate, if a bit odd...
    If somebody more knowledgeable could tell me firstly if it's anything sinister and secondly (if not) what may have cause it and whether it's an issue I should investigate on this machine.
    Thanks in advance, below is the contents of the text file. (As you can see I'm brand new to these forums, apologies if this is not the correct section for these kind of questions).
    # An unexpected error has been detected by Java Runtime Environment:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d5ecb6d, pid=3268, tid=2164
    # Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode windows-x86)
    # Problematic frame:
    # C 0x6d5ecb6d
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    --------------- T H R E A D ---------------
    Current thread (0x0e2fc400): JavaThread "Headspace mixer frame proc thread" daemon [_thread_in_native, id=2164, stack(0x0e250000,0x0e2a0000)]
    siginfo: ExceptionCode=0xc0000005, reading address 0x6d5ecb6d
    Registers:
    EAX=0x0e19aa10, EBX=0x0e18b8a2, ECX=0x00000080, EDX=0x6d5ecb6d
    ESP=0x0e29f740, EBP=0x0e29f788, ESI=0x00000080, EDI=0x0e18dda8
    EIP=0x6d5ecb6d, EFLAGS=0x00010202
    Top of Stack: (sp=0x0e29f740)
    0x0e29f740: 6d52ac78 0e2fc514 0e18dda8 00000000
    0x0e29f750: 0e2f0000 00000000 00000080 00000000
    0x0e29f760: 0e18dda8 00000000 0001af00 0001af00
    0x0e29f770: 002c6fe0 00000000 0e2f0000 0e100000
    0x0e29f780: 00000000 000021f8 0e2fc514 6d52b745
    0x0e29f790: 0e2fc514 80002d5a 0e2fc514 00000200
    0x0e29f7a0: 002c6fe0 0e29f7c0 00000000 00000010
    0x0e29f7b0: 6d52e6c0 0e2fc514 002c6fe0 00000000
    Instructions: (pc=0x6d5ecb6d)
    0x6d5ecb5d:
    [error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xc0000005]
    Stack: [0x0e250000,0x0e2a0000], sp=0x0e29f740, free space=317k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C 0x6d5ecb6d
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j com.sun.media.sound.MixerThread.runNative(J)V+0
    j com.sun.media.sound.MixerThread.run()V+5
    v ~StubRoutines::call_stub
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    =>0x0e2fc400 JavaThread "Headspace mixer frame proc thread" daemon [_thread_in_native, id=2164, stack(0x0e250000,0x0e2a0000)]
    0x0e2fc000 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1604, stack(0x0e0b0000,0x0e100000)]
    0x0e2fb800 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=3748, stack(0x0dea0000,0x0def0000)]
    0x0c625c00 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=4796, stack(0x0dda0000,0x0ddf0000)]
    0x0c628400 JavaThread "AWT-EventQueue-1" [_thread_blocked, id=5976, stack(0x0dd00000,0x0dd50000)]
    0x0c628000 JavaThread "Keep-Alive-Timer" daemon [_thread_blocked, id=3688, stack(0x0dcb0000,0x0dd00000)]
    0x0c627800 JavaThread "Thread-12" [_thread_blocked, id=5696, stack(0x0dbc0000,0x0dc10000)]
    0x0c627400 JavaThread "Thread-10" [_thread_blocked, id=3600, stack(0x0db70000,0x0dbc0000)]
    0x0c627000 JavaThread "thread applet-vmain.class-4" [_thread_blocked, id=3184, stack(0x0db20000,0x0db70000)]
    0x0c626800 JavaThread "Thread-11" [_thread_blocked, id=3308, stack(0x0dad0000,0x0db20000)]
    0x0c626400 JavaThread "Thread-9" [_thread_blocked, id=888, stack(0x0da80000,0x0dad0000)]
    0x0c625800 JavaThread "thread applet-vmain.class-2" [_thread_blocked, id=3848, stack(0x0df30000,0x0df80000)]
    0x0c624c00 JavaThread "Image Fetcher 3" daemon [_thread_blocked, id=3588, stack(0x0d9e0000,0x0da30000)]
    0x0c624400 JavaThread "AWT-EventQueue-5" [_thread_blocked, id=3932, stack(0x0d990000,0x0d9e0000)]
    0x0c624000 JavaThread "Applet 4 LiveConnect Worker Thread" [_thread_blocked, id=5964, stack(0x0d940000,0x0d990000)]
    0x0c623000 JavaThread "AWT-EventQueue-4" [_thread_blocked, id=824, stack(0x0d8f0000,0x0d940000)]
    0x0c623c00 JavaThread "Applet 3 LiveConnect Worker Thread" [_thread_blocked, id=4600, stack(0x0d850000,0x0d8a0000)]
    0x0c623400 JavaThread "AWT-EventQueue-3" [_thread_blocked, id=3516, stack(0x0d8a0000,0x0d8f0000)]
    0x0c621c00 JavaThread "Applet 2 LiveConnect Worker Thread" [_thread_blocked, id=4528, stack(0x0d7b0000,0x0d800000)]
    0x0c622800 JavaThread "AWT-EventQueue-2" [_thread_blocked, id=5296, stack(0x0d800000,0x0d850000)]
    0x0c622400 JavaThread "Applet 1 LiveConnect Worker Thread" [_thread_blocked, id=3788, stack(0x0d0e0000,0x0d130000)]
    0x0c621800 JavaThread "Browser Side Object Cleanup Thread" [_thread_blocked, id=1152, stack(0x0d760000,0x0d7b0000)]
    0x0c621000 JavaThread "Windows Tray Icon Thread" [_thread_in_native, id=5244, stack(0x0d470000,0x0d4c0000)]
    0x0c620c00 JavaThread "CacheCleanUpThread" daemon [_thread_blocked, id=5136, stack(0x0d420000,0x0d470000)]
    0x0c618000 JavaThread "CacheMemoryCleanUpThread" daemon [_thread_blocked, id=3540, stack(0x0d3d0000,0x0d420000)]
    0x0c617000 JavaThread "Java Plug-In Heartbeat Thread" [_thread_blocked, id=3532, stack(0x0d380000,0x0d3d0000)]
    0x0c616c00 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=2044, stack(0x0d130000,0x0d180000)]
    0x0c609800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=4612, stack(0x0d090000,0x0d0e0000)]
    0x0c606000 JavaThread "AWT-Shutdown" [_thread_blocked, id=5280, stack(0x0cbc0000,0x0cc10000)]
    0x0c605800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5408, stack(0x0ca00000,0x0ca50000)]
    0x022ff800 JavaThread "Java Plug-In Pipe Worker Thread (Client-Side)" [_thread_in_native, id=2340, stack(0x0c9b0000,0x0ca00000)]
    0x022bc000 JavaThread "traceMsgQueueThread" daemon [_thread_blocked, id=3872, stack(0x0c8d0000,0x0c920000)]
    0x0c5c0400 JavaThread "Timer-0" [_thread_blocked, id=6076, stack(0x0c880000,0x0c8d0000)]
    0x022b4000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2036, stack(0x0c4e0000,0x0c530000)]
    0x022adc00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3908, stack(0x0c490000,0x0c4e0000)]
    0x022ab800 JavaThread "Attach Listener" daemon [_thread_blocked, id=1768, stack(0x0c440000,0x0c490000)]
    0x022a0c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5708, stack(0x0c3f0000,0x0c440000)]
    0x02291000 JavaThread "Finalizer" daemon [_thread_blocked, id=4484, stack(0x0c3a0000,0x0c3f0000)]
    0x0228c800 JavaThread "Reference Handler" daemon [_thread_blocked, id=4220, stack(0x02300000,0x02350000)]
    0x02399800 JavaThread "main" [_thread_blocked, id=3472, stack(0x008c0000,0x00910000)]
    Other Threads:
    0x02287400 VMThread [stack: 0x01a30000,0x01a80000] [id=5028]
    0x022b5400 WatcherThread [stack: 0x0c530000,0x0c580000] [id=5604]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 960K, used 251K [0x043a0000, 0x044a0000, 0x04880000)
    eden space 896K, 20% used [0x043a0000, 0x043cec30, 0x04480000)
    from space 64K, 100% used [0x04480000, 0x04490000, 0x04490000)
    to space 64K, 0% used [0x04490000, 0x04490000, 0x044a0000)
    tenured generation total 4096K, used 1436K [0x04880000, 0x04c80000, 0x083a0000)
    the space 4096K, 35% used [0x04880000, 0x049e7130, 0x049e7200, 0x04c80000)
    compacting perm gen total 12288K, used 10102K [0x083a0000, 0x08fa0000, 0x0c3a0000)
    the space 12288K, 82% used [0x083a0000, 0x08d7da68, 0x08d7dc00, 0x08fa0000)
    No shared spaces configured.
    Dynamic libraries:
    0x00400000 - 0x00424000      C:\Program Files\Java\jre6\bin\java.exe
    0x77190000 - 0x772b7000      C:\Windows\system32\ntdll.dll
    0x75950000 - 0x75a2c000      C:\Windows\system32\kernel32.dll
    0x770c0000 - 0x77186000      C:\Windows\system32\ADVAPI32.dll
    0x761e0000 - 0x762a3000      C:\Windows\system32\RPCRT4.dll
    0x724d0000 - 0x724ee000      C:\Windows\system32\ShimEng.dll
    0x75670000 - 0x7569c000      C:\Windows\system32\apphelp.dll
    0x6acf0000 - 0x6ad78000      C:\Windows\AppPatch\AcLayers.DLL
    0x77350000 - 0x773ed000      C:\Windows\system32\USER32.dll
    0x75d60000 - 0x75dab000      C:\Windows\system32\GDI32.dll
    0x76460000 - 0x76f70000      C:\Windows\system32\SHELL32.dll
    0x762c0000 - 0x7636a000      C:\Windows\system32\msvcrt.dll
    0x758f0000 - 0x75949000      C:\Windows\system32\SHLWAPI.dll
    0x76f70000 - 0x770b5000      C:\Windows\system32\ole32.dll
    0x75ac0000 - 0x75b4d000      C:\Windows\system32\OLEAUT32.dll
    0x756f0000 - 0x7570e000      C:\Windows\system32\USERENV.dll
    0x756d0000 - 0x756e4000      C:\Windows\system32\Secur32.dll
    0x72b00000 - 0x72b42000      C:\Windows\system32\WINSPOOL.DRV
    0x750e0000 - 0x750f4000      C:\Windows\system32\MPR.dll
    0x758d0000 - 0x758ee000      C:\Windows\system32\IMM32.DLL
    0x75db0000 - 0x75e78000      C:\Windows\system32\MSCTF.dll
    0x762b0000 - 0x762b9000      C:\Windows\system32\LPK.DLL
    0x75a30000 - 0x75aad000      C:\Windows\system32\USP10.dll
    0x10000000 - 0x10011000      C:\PROGRA~1\KASPER~1\KASPER~1.0FO\r3hook.dll
    0x75830000 - 0x75837000      C:\Windows\system32\PSAPI.DLL
    0x752d0000 - 0x7546e000      C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\comctl32.dll
    0x7c340000 - 0x7c396000      C:\Program Files\Java\jre6\bin\msvcr71.dll
    0x6d800000 - 0x6da56000      C:\Program Files\Java\jre6\bin\client\jvm.dll
    0x74200000 - 0x74232000      C:\Windows\system32\WINMM.dll
    0x741c0000 - 0x741f9000      C:\Windows\system32\OLEACC.dll
    0x6d280000 - 0x6d288000      C:\Program Files\Java\jre6\bin\hpi.dll
    0x6d7b0000 - 0x6d7bc000      C:\Program Files\Java\jre6\bin\verify.dll
    0x6d320000 - 0x6d33f000      C:\Program Files\Java\jre6\bin\java.dll
    0x6d7f0000 - 0x6d7ff000      C:\Program Files\Java\jre6\bin\zip.dll
    0x6d430000 - 0x6d436000      C:\Program Files\Java\jre6\bin\jp2native.dll
    0x6d1c0000 - 0x6d1d3000      C:\Program Files\Java\jre6\bin\deploy.dll
    0x74fe0000 - 0x750d2000      C:\Windows\system32\CRYPT32.dll
    0x75140000 - 0x75152000      C:\Windows\system32\MSASN1.dll
    0x76370000 - 0x76456000      C:\Windows\system32\WININET.dll
    0x00950000 - 0x00953000      C:\Windows\system32\Normaliz.dll
    0x75e80000 - 0x75fb3000      C:\Windows\system32\urlmon.dll
    0x75fc0000 - 0x761a8000      C:\Windows\system32\iertutil.dll
    0x6d6b0000 - 0x6d6f2000      C:\Program Files\Java\jre6\bin\regutils.dll
    0x749a0000 - 0x749a8000      C:\Windows\system32\VERSION.dll
    0x6ee30000 - 0x6f057000      C:\Windows\system32\msi.dll
    0x6d610000 - 0x6d623000      C:\Program Files\Java\jre6\bin\net.dll
    0x77320000 - 0x7734d000      C:\Windows\system32\WS2_32.dll
    0x75ab0000 - 0x75ab6000      C:\Windows\system32\NSI.dll
    0x74cc0000 - 0x74cfb000      C:\Windows\system32\mswsock.dll
    0x74d30000 - 0x74d35000      C:\Windows\System32\wship6.dll
    0x6d630000 - 0x6d639000      C:\Program Files\Java\jre6\bin\nio.dll
    0x6d000000 - 0x6d138000      C:\Program Files\Java\jre6\bin\awt.dll
    0x746a0000 - 0x746ac000      C:\Windows\system32\DWMAPI.DLL
    0x746e0000 - 0x7471f000      C:\Windows\system32\uxtheme.dll
    0x6d220000 - 0x6d274000      C:\Program Files\Java\jre6\bin\fontmanager.dll
    0x74980000 - 0x74985000      C:\Windows\System32\wshtcpip.dll
    0x74620000 - 0x7462f000      C:\Windows\system32\NLAapi.dll
    0x74f40000 - 0x74f59000      C:\Windows\system32\IPHLPAPI.DLL
    0x74f00000 - 0x74f35000      C:\Windows\system32\dhcpcsvc.DLL
    0x75220000 - 0x7524c000      C:\Windows\system32\DNSAPI.dll
    0x74ee0000 - 0x74ee7000      C:\Windows\system32\WINNSI.DLL
    0x74eb0000 - 0x74ed2000      C:\Windows\system32\dhcpcsvc6.DLL
    0x736e0000 - 0x736ef000      C:\Windows\system32\napinsp.dll
    0x73150000 - 0x73162000      C:\Windows\system32\pnrpnsp.dll
    0x736d0000 - 0x736d8000      C:\Windows\System32\winrnr.dll
    0x772d0000 - 0x77319000      C:\Windows\system32\WLDAP32.dll
    0x73d20000 - 0x73d26000      C:\Windows\system32\rasadhlp.dll
    0x74a70000 - 0x74aab000      C:\Windows\system32\rsaenh.dll
    0x6d520000 - 0x6d544000      C:\Program Files\Java\jre6\bin\jsound.dll
    0x6d550000 - 0x6d558000      C:\Program Files\Java\jre6\bin\jsoundds.dll
    0x74110000 - 0x74180000      C:\Windows\system32\DSOUND.dll
    0x74a00000 - 0x74a1a000      C:\Windows\system32\POWRPROF.dll
    0x716d0000 - 0x716ff000      C:\Windows\system32\wdmaud.drv
    0x70620000 - 0x70624000      C:\Windows\system32\ksuser.dll
    0x74190000 - 0x741b8000      C:\Windows\system32\MMDevAPI.DLL
    0x74630000 - 0x74637000      C:\Windows\system32\AVRT.dll
    0x75bd0000 - 0x75d5a000      C:\Windows\system32\SETUPAPI.dll
    0x747e0000 - 0x7480d000      C:\Windows\system32\WINTRUST.dll
    0x761b0000 - 0x761d9000      C:\Windows\system32\imagehlp.dll
    0x705f0000 - 0x70611000      C:\Windows\system32\AUDIOSES.DLL
    0x70410000 - 0x70476000      C:\Windows\system32\audioeng.dll
    0x716c0000 - 0x716c9000      C:\Windows\system32\msacm32.drv
    0x71360000 - 0x71374000      C:\Windows\system32\MSACM32.dll
    0x71460000 - 0x71467000      C:\Windows\system32\midimap.dll
    0x75840000 - 0x758c4000      C:\Windows\system32\CLBCatQ.DLL
    VM Arguments:
    jvm_args: -D__jvm_launched=614157692976 -Xbootclasspath/a:C:\\PROGRA~1\\Java\\jre6\\lib\\deploy.jar;C:\\PROGRA~1\\Java\\jre6\\lib\\javaws.jar;C:\\PROGRA~1\\Java\\jre6\\lib\\plugin.jar -Dsun.plugin2.jvm.args=-D__jvm_launched=614157692976 "-Xbootclasspath/a:C:\\\\PROGRA~1\\\\Java\\\\jre6\\\\lib\\\\deploy.jar;C:\\\\PROGRA~1\\\\Java\\\\jre6\\\\lib\\\\javaws.jar;C:\\\\PROGRA~1\\\\Java\\\\jre6\\\\lib\\\\plugin.jar" "-Djava.class.path=C:\\\\PROGRA~1\\\\Java\\\\jre6\\\\classes" --
    java_command: sun.plugin2.main.client.PluginMain write_pipe_name=jpi2_pid568_pipe9,read_pipe_name=jpi2_pid568_pipe8
    Launcher Type: SUN_STANDARD
    Environment Variables:
    PATH=C:\Program Files\Internet Explorer;;C:\Program Files\Microsoft Office\Office12\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Windows\System32\WindowsPowerShell\v1.0\
    USERNAME=xxxxxx
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows Vista Build 6002 Service Pack 2
    CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 7 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3
    Memory: 4k page, physical 2097151k(1436212k free), swap 4194303k(4194303k free)
    vm_info: Java HotSpot(TM) Client VM (11.0-b16) for windows-x86 JRE (1.6.0_11-b03), built on Nov 10 2008 02:15:12 by "java_re" with MS VC++ 7.1
    time: Thu Oct 28 12:01:14 2010
    elapsed time: 1 seconds

    Rob~R wrote:
    A colleague's PC has a log file on the desktop, created 28th October. Its title: 'hs_err_pid3268.log'
    Initially we were both concerned since Kaspersky had detected some viruses on his machine on it's nightly scan, however, looking at the log file I'm not sure whether to be worried or not! - It looks legitimate, if a bit odd...
    If somebody more knowledgeable could tell me firstly if it's anything sinister and secondly (if not) what may have cause it and whether it's an issue I should investigate on this machine.
    Thanks in advance, below is the contents of the text file. (As you can see I'm brand new to these forums, apologies if this is not the correct section for these kind of questions). It is a crash file from the Sun/Oracle VM.
    It either got on the desktop because a user manually moved it there or because something is probably misconfigured (at least to me) in the environment.
    If you are creating java applications (programming in the java language) then you would need to figure out why the app crashed.
    If you are using java applications then you need to tell the vendor that it crashed. And you would not do that here.

  • Question about Java Sound example?

    Hello,
    I found this example AudioPlayer, when searching for an example of how to play .wav files in Java.
    The code seems quite long, and wondered if anyone could advise if this is the best way to play a wav file?
    And could anyone explain if the EXTERNAL_BUFFER_SIZE should allows be set to 128000;
    Thank you
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    public class SimpleAudioPlayer
         private static final int     EXTERNAL_BUFFER_SIZE = 128000;
         public static void main(String[] args)
                We check that there is exactely one command-line
                argument.
                If not, we display the usage message and exit.
              if (args.length != 1)
                   printUsageAndExit();
                Now, that we're shure there is an argument, we
                take it as the filename of the soundfile
                we want to play.
              String     strFilename = args[0];
              File     soundFile = new File(strFilename);
                We have to read in the sound file.
              AudioInputStream     audioInputStream = null;
              try
                   audioInputStream = AudioSystem.getAudioInputStream(soundFile);
              catch (Exception e)
                     In case of an exception, we dump the exception
                     including the stack trace to the console output.
                     Then, we exit the program.
                   e.printStackTrace();
                   System.exit(1);
                From the AudioInputStream, i.e. from the sound file,
                we fetch information about the format of the
                audio data.
                These information include the sampling frequency,
                the number of
                channels and the size of the samples.
                These information
                are needed to ask Java Sound for a suitable output line
                for this audio file.
              AudioFormat     audioFormat = audioInputStream.getFormat();
                Asking for a line is a rather tricky thing.
                We have to construct an Info object that specifies
                the desired properties for the line.
                First, we have to say which kind of line we want. The
                possibilities are: SourceDataLine (for playback), Clip
                (for repeated playback)     and TargetDataLine (for
                recording).
                Here, we want to do normal playback, so we ask for
                a SourceDataLine.
                Then, we have to pass an AudioFormat object, so that
                the Line knows which format the data passed to it
                will have.
                Furthermore, we can give Java Sound a hint about how
                big the internal buffer for the line should be. This
                isn't used here, signaling that we
                don't care about the exact size. Java Sound will use
                some default value for the buffer size.
              SourceDataLine     line = null;
              DataLine.Info     info = new DataLine.Info(SourceDataLine.class,
                                                                 audioFormat);
              try
                   line = (SourceDataLine) AudioSystem.getLine(info);
                     The line is there, but it is not yet ready to
                     receive audio data. We have to open the line.
                   line.open(audioFormat);
              catch (LineUnavailableException e)
                   e.printStackTrace();
                   System.exit(1);
              catch (Exception e)
                   e.printStackTrace();
                   System.exit(1);
                Still not enough. The line now can receive data,
                but will not pass them on to the audio output device
                (which means to your sound card). This has to be
                activated.
              line.start();
                Ok, finally the line is prepared. Now comes the real
                job: we have to write data to the line. We do this
                in a loop. First, we read data from the
                AudioInputStream to a buffer. Then, we write from
                this buffer to the Line. This is done until the end
                of the file is reached, which is detected by a
                return value of -1 from the read method of the
                AudioInputStream.
              int     nBytesRead = 0;
              byte[]     abData = new byte[EXTERNAL_BUFFER_SIZE];
              while (nBytesRead != -1)
                   try
                        nBytesRead = audioInputStream.read(abData, 0, abData.length);
                   catch (IOException e)
                        e.printStackTrace();
                   if (nBytesRead >= 0)
                        int     nBytesWritten = line.write(abData, 0, nBytesRead);
                Wait until all data are played.
                This is only necessary because of the bug noted below.
                (If we do not wait, we would interrupt the playback by
                prematurely closing the line and exiting the VM.)
                Thanks to Margie Fitch for bringing me on the right
                path to this solution.
              line.drain();
                All data are played. We can close the shop.
              line.close();
                There is a bug in the jdk1.3/1.4.
                It prevents correct termination of the VM.
                So we have to exit ourselves.
              System.exit(0);
         private static void printUsageAndExit()
              out("SimpleAudioPlayer: usage:");
              out("\tjava SimpleAudioPlayer <soundfile>");
              System.exit(1);
         private static void out(String strMessage)
              System.out.println(strMessage);
    }

    I didnot go thru the code you posted but I know that the following workstry {
            // From file
            AudioInputStream stream = AudioSystem.getAudioInputStream(new File("audiofile"));
            // From URL
            stream = AudioSystem.getAudioInputStream(new URL("http://hostname/audiofile"));
            // At present, ALAW and ULAW encodings must be converted
            // to PCM_SIGNED before it can be played
            AudioFormat format = stream.getFormat();
            if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
                format = new AudioFormat(
                        AudioFormat.Encoding.PCM_SIGNED,
                        format.getSampleRate(),
                        format.getSampleSizeInBits()*2,
                        format.getChannels(),
                        format.getFrameSize()*2,
                        format.getFrameRate(),
                        true);        // big endian
                stream = AudioSystem.getAudioInputStream(format, stream);
            // Create the clip
            DataLine.Info info = new DataLine.Info(
                Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
            Clip clip = (Clip) AudioSystem.getLine(info);
            // This method does not return until the audio file is completely loaded
            clip.open(stream);
            // Start playing
            clip.start();
        } catch (MalformedURLException e) {
        } catch (IOException e) {
        } catch (LineUnavailableException e) {
        } catch (UnsupportedAudioFileException e) {
        }

  • Simple Java Sound Question...

    Can I draw waveforms while capturing data? If yes, how. If no, why.
    Thanks. I need the answer ASAP, please help.

    Hi nfactorial,
    Can I draw waveforms while capturing data?If you would like to do that in Java you would need to know about how to use the Java language in general and especially about the Java Sound and Java2D APIs.
    If yes, how.It would be too much to explain to answer such a general question. A general answer is, you need to use the Java Sound API to capture the data for which a waveform should be drawn. The Sound API delivers data as a stream of bytes typically encoded in pulse coded modulation (PCM) format. The data stream has digital samples each representing a level of sound pressure for a certain point in time. The stream of samples in the amplitude/time domain need to be transformed to a spectrum of samples in the amplitude/frequency domain, i.e. a number of PCM samples need to be mapped to the frequencies that should be displayed. This is done with the fast fourier transformation algorithm. Each set of amplitude/frequency values can then be displayed as a waveform by using some line drawing logic. The entire process would need to run constantly, i.e. as bytes are received from the sound data stream transformation and drawing is triggered.
    Related readings:
    Java Tutorial
    http://java.sun.com/docs/books/tutorial/
    Java Sound Documentation
    http://java.sun.com/j2se/1.5.0/docs/guide/sound/index.html
    Java Sound API Programmer's Guide
    http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html
    Java Sound Resources
    http.//www.jsresources.org
    Java 2D Graphics Tutorial
    http://java.sun.com/docs/books/tutorial/2d/index.html
    Wikipedia on fast fourier transformation
    http://en.wikipedia.org/wiki/Fast_fourier_transform
    HTH
    Ulrich

  • A bug in Java

    I would like to report a bug in Java.
    It began with the rmi tutorial on computing pi.
    I had no problem with this on a single computer but could never get it to work over the network. I posted messages on this forum and got lots of generous help, especially from Genady, but eventually I left it as an unsolved problem.
    Yesterday I came back to my local network with my current problem and had problems similar to pi. Now at least I have more experience and I could track it down. It looks like a Java bug to me.
    The hardware is: 1 router, behind which sit 2 computers: home-ilan at 192.168.2.100 and home-yona at 192.168.2.103. I have a client-server setup via rmi. If the server is on home-yona, all works OK. If the server is on home-ilan it fails. What could be the difference?
    It turns out that home-ilan (my main computer) also has the possibility to run VPN to the hospital. The VPN uses a given IP. If I need to get to the hospital, I use the VPN. If not, I don't use it.
    Yesterday I put Eclipse on home-yona and looked for the problem. It turns out to be in
    Query q1 = (Query) Naming.lookup(rmi1);I was running the query from home-yona to home-ilan. I got a valid q1 back, and I drilled down into it. One of the elements is
    ep=TCPEndpoint which has a host value.
    The host value should have been 192.168.2.100, but instead it was the value of the VPN. The packet was sent from 192.168.2.100 to 192.168.2.103 and home-yona picked up the packet correctly, but it had the wrong value of the host. When I actually made the query to rmi, it expected the result from the VPN IP, which it never got, so it timed out.
    The bug is that Naming.lookup, even though it got the packet through the LAN, gave VPN address. This would have been fine had I been querying from the hospital, but I was in fact doing a local query. The Naming.lookup doesn't differentiate, which is a bug.
    The bug is 100% reproducible. If I start the server while VPN is running, from home-yona I will always get the VPN IP. If I start the server while VPN is turned off, I will get the correct address.
    Any suggestions?
    Ilan

    If that were the only thing which was wrong, we'd be in great shape. It is then a bug of Cisco Systems who supplied the VPN. I just took the default conditions and used them. I had no idea there was any problem until I ran the RMI protocol.
    In fairness to Cisco Systems, I must say that it is unusal to say that I want a VPN connection into the hospital and at the same time make a connection over my local LAN. In fact it works for everything I happened to try up until now, but it fails for RMI (because of the static assignment).
    The amazing thing is that with all these incompatible programs is not that sometimes it fails, but that it works at all. When I look at the Control Panel, I see 2 LAN connections, my local LAN and the VPN. I suspect I would have a very similar problem if I had 2 physical LAN cards.
    The home-ilan identifies the computer and it doesn't identify the computer-lan combination.
    What the RMI wants is not the computer identification, but rather the lan card identification. At least in the Control Panel, such a thing doesn't exist.

  • How can I get what the service pack is installed on my machine from java co

    Hi..
    Advanced Thanks to everyone, who visit this thread..
    In one of my program, I need to find, my Operating System details from java code.. ofcourse I can get OS type and version by System.getProperties().., But especially I need to get what the service pack is installed.. SP1 or SP2.. Can anyone tell me how can I get that info..

    Prasad.Kollipara wrote:
    Hi boss..
    Not to hack the system or not check whether it is hackable or not..
    I am developing a tool and before installing it, I need to verify whether it satisfy the requirements or not..
    My tool need Minimum Windows Server 2003 OS with SP2..Why would a Java application need that? Sounds like something that should have been done in C#.

  • A possible *bug* in java jcombobox

    Hi all,
    I think i found a possible bug in java jcombobox .. i am sure some of you must have already experienced it..
    supposedly you put a jcombobox in a jpanel
    returned the panel from a method to a calling method..
    and that method adds it to another panel that it had created to a frame..
    and if this happens dynamicaly at runtime, as only after u click a button..
    meaning : without adding the combobox or the immediate parent panelto the contentpane .. directly..
    Then,
    your combox's keylistener may not catch events fired.
    .. this has happened to me many times.. and always i could only find a way out
    .. by adding the combobox to panel that is loaded during startup itself and is
    .. not returned through a method call.
    Your opinions please ?
    'Harish.

    All components in a UI are created at run-time.
    When you create your JFrame you call pack() to align and resize the UI. This validates all the components, and sets the default focus on what ever component should have the focus at start up.
    When you create components and add them as children of another component you have to validate the child and parent. This can be done by calling JComponent.validate()
    As for keylisteners not getting called, this might be fixed if you call grabFocus on the new combobox. I can't see a reason why any listener would stop working.
    For me to really understand what your talking about. I'd need to see source code reproducing this problem.

  • Bug in java arrays?

    Hi, just found this in a toy program and thought it might be a bug in the way java handles arrays... I'm working on Suse 8.0 & jdk 1.4, Red Hat 7.x/8.x with jdk 1.4 and Solaris 4 jdk 1.4:
    If you have a method like this:
        public static void resize(int[] arr, int size) {
            int[] tmp = arr;
            int iterate;
            arr = new int[size];  // disassociate tmp from arr
            iterate = size > tmp.length ? tmp.length : size;
            for(int x = 0; x < iterate; x++) {
                arr[x] = tmp[x];
        }and try to call it from another class like this:
            /* could this possibly be a bug in java??? */
            Arrays.resize(state, state.length + 1);  // make array bigger
            state[state.length - 1] = start;  // store current room in arrayI get an ArrayIndexOutOfBoundsException on the call to assign start to the last index of state, which means that the new array knows its new length, but can't assign to it.
    The solution to my problem was to return arr in the resize() method and assign the returned value to state.
    This seems to go against what its supposed to happen (that the array is rezized and the pointer just updated)
    Is this a bug in java or is it te desired behaviour?
    dave.

    But when I create the 'new' array I'm assigning the
    pointer to the place where the previous array pointer
    was... This should be completely legal. Yes, it's completely legal, but it doesn't do what you want :)
    The variable in method to which you assign a new and longer array is a different one than the pointer you have in another method.
    If you just call a function to assign values to an
    array like this:> public void update(int[]arr){
    arr[0] = 2;
    } > and then use some code to look at the array you
    passed: > int[]x = {1,2,3,4};
    update(x);
    system.out.println(x[0]);> you would expect to get 2 in the
    output. Whay should this operation be different?Because in this case you wrap the reference you change (slot 0 in the array) into another object (the array). Therefore the reference you actually change is the same as the reference you expect to change.
    If you let your resize method return the new and longer array, and assign the returned value to yor old variable, you might get a better result.
    (And System.arraycopy may be more efficient than your for loop.)

  • Using the 'java.sound.*' libraries and classes

    Hello,
    I am a complete noob to Java. So please forgive me if I seem a little stupid in the things I ask.
    I would like to know which development kit I should download to be able to gain access to the 'java.sound.*' and midi libraries and classes.
    I downloaded the Java SE 6 SDK but I could get access to these classes.
    I use JCreator as my compiler and I kept getting an error along the lines of 'java.sound.* package does not exist'. I have tried compiling the code with NetBeans and also wiuth Eclipse and I still have no luck and I get the same message. I am guessing the compiler is not the problem and it is the SDK as I can access other classes such as javax.swing and java.awt etc.
    If you could give me a link to the relevant SDK and maybe a good compiler, it would be greatly appreciated.
    Also I am using Windows XP and Windows Vista so if you could provide me with support for either of these operating systems then that would be great.
    Thank You
    Lee

    Here's the code for an SSCCE (Small Self Contained Compilable Example) of a working java sound application. If you don't provide a file name, It does expect you to have a wave file of Ballroom Blitz in your javatest directory, but doesn't everybody?
    To build and run it do:
    javac -cp . SoundPlayer.java
    java -cp . SoundPlayer  yourWaveFile.wav  
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.sound.sampled.DataLine.*;
    public class SoundPlayer implements LineListener
         private float bufTime;
         private File soundFile;
         private SourceDataLine line;
         private AudioInputStream stream;
         private AudioFormat format;
         private Info info;
         private boolean opened;
         private int frameSize;
         private long frames;
         private int bufFrames;
         private int bufsize;
         private boolean running;
         private boolean shutdown;
         private long firstFrame, lastFrame;
         private float frameRate;
         private long currentFrame;
         private float currentTime;
         private Thread playThread;
         // constructor, take a path to an audio file
         public SoundPlayer(String path)
              this(path, 2);     // use 2 second buffer
         // or a path and a buffer size
         public SoundPlayer(String path, float bt)
              this(new File(path),bt);
         public SoundPlayer(File sf)
              this(sf, 2);  // use 2 second buffer
         public SoundPlayer(File sf, float bt)
              bufTime = bt;          // seconds per buffer
              soundFile = sf;
              openSound();
         private void openSound()
              System.out.println("Opening file"+soundFile.getName());
              try
                   firstFrame = 0;
                   currentFrame = 0;
                   shutdown = false;
                   running = false;
                   stream=AudioSystem.getAudioInputStream(soundFile);
                   format=stream.getFormat();
                   if(format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED)
                        System.out.println("Converting Audio stream format");
                        stream = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED,stream);
                        format = stream.getFormat();
                   frameSize = format.getFrameSize();
                   frames = stream.getFrameLength();
                   lastFrame = frames;
                   frameRate = format.getFrameRate();
                   bufFrames = (int)(frameRate*bufTime);
                   bufsize = frameSize * bufFrames;
                   System.out.println("frameRate="+frameRate);
                   System.out.println("frames="+frames+" frameSize="+frameSize+" bufFrames="+bufFrames+" bufsize="+bufsize);
                   info=new Info(SourceDataLine.class,format,bufsize);
                   line = (SourceDataLine)AudioSystem.getLine(info);
                   line.addLineListener(this);
                   line.open(format,bufsize);
                   opened = true;
              catch(Exception e)
                   e.printStackTrace();
         public void stop()
              System.out.println ("Stopping");
              if(running)
                   running = false;
                   shutdown = true;
                   if(playThread != null)
                        playThread.interrupt();
                        try{playThread.join();}
                        catch(Exception e){e.printStackTrace();}
              if (opened) close();
         private void close()
              System.out.println("close line");
              line.close();
              try{stream.close();}catch(Exception e){}
              line.removeLineListener(this);
              opened = false;
         // set the start and stop time
         public void setTimes(float t0, float tz)
              currentTime = t0;
              firstFrame = (long)(frameRate*t0);
              if(tz > 0)
                   lastFrame = (long)(frameRate*tz);
              else lastFrame = frames;
              if(lastFrame > frames)lastFrame = frames;
              if(firstFrame > lastFrame)firstFrame = lastFrame;
         public void playAsync(float start, float end)
              setTimes(start,end);
              playAsync();
         // play the sound asynchronously */
         public void playAsync()
              System.out.println("Play async");
              if(!opened)openSound();
              if(opened && !running)
                   playThread = new Thread(new Runnable(){public void run(){play();}});
                   playThread.start();
         public void play(float start, float end)
              setTimes(start,end);
              play();
         // play the sound in the calling thread
         public void play()
              if(!opened)openSound();
              if(opened && !running)
                   running = true;
                   int writeSize = frameSize*bufFrames/2; // amount we write at a time
                   byte buf[] = new byte[writeSize];     // our io buffer
                   int len;
                   long framesRemaining = lastFrame-firstFrame;
                   int framesRead;
                   currentFrame=firstFrame;
                   System.out.println("playing file, firstFrame="+firstFrame+" lastFrame="+lastFrame);
                   try
                        line.start();
                        if(firstFrame > 0)
                             long sa = firstFrame * frameSize;
                             System.out.println("Skipping "+firstFrame+" frames="+sa+" bytes");
                             while(sa > 0)sa -= stream.skip(sa);
                        while (running && framesRemaining > 0)
                             len = stream.read(buf,0,writeSize); // read our block
                             if(len > 0)
                                  framesRead = len/frameSize;
                                  framesRemaining -= framesRead;
                                  currentTime = currentFrame/frameRate;
                                  if(currentTime < 0)throw(new Exception("time too low"));
                                  System.out.println("time="+currentTime+" writing "+len+" bytes");
                                  line.write(buf,0,len);
                                  currentFrame+=framesRead;
                             else framesRemaining = 0;
                        if(running)
                             line.drain();                     // let it play out
                             while(line.isActive() && running)
                                  System.out.println("line active");
                                  Thread.sleep(100);
                             shutdown = true;
                        running = false;
                   catch(Exception e)
                        e.printStackTrace();
                        shutdown = true;
                        running = false;
                   if(shutdown)
                        close();
         // return current time relative to start of sound
         public float getTime()
              return ((float)line.getMicrosecondPosition())/1000000;
         // return total time
         public float getLength()
              return (float)frames / frameRate;
         // stop the sound playback, return time in seconds
         public float  pause()
              running = false;
              line.stop();
              return getTime();
         public void update(LineEvent le)
              System.out.println("Line event"+le.toString());
         // play a short simple PCM encoded clip
         public static void playShortClip(String fnm)
              java.applet.AudioClip clip=null;
              try
                   java.io.File file = new java.io.File(fnm);     // get a file for the name provided
                   if(file.exists())                    // only try to use a real file
                        clip = java.applet.Applet.newAudioClip(file.toURL()); // get the audio clip
                   else
                        System.out.println("file="+fnm+" not found");
              catch(Exception e)
                   System.out.println("Error building audio clip from file="+fnm);
                   e.printStackTrace();
              if(clip != null)     // we may not actually have a clip
                   final java.applet.AudioClip rclip = clip;
                   new Thread
                   (new Runnable()
                             public void run()
                                  rclip.play();
                   ).start();
         public boolean isOpened()
              return opened;
         public boolean isRunning()
              return running;
        public void showControls() {
            Control [] controls = line.getControls();
            for (Control c :controls) {
                System.out.println(c.toString());
        public void setGain(float gain) {
            FloatControl g = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
            g.setValue(gain);
        public static void main(String [] args) {
            float gain = 0;
            String file = "c:\\javatest\\BallroomBlitz.wav";
              for(String arg : args) {
                for(int i = 0; i < arg.length(); i++) {
                    char c  = arg.charAt(i);
                    if (c == '-') {
                        gain -= 1;
                    } else if (c == '+') {
                        gain += 1;
                    } else {
                             file = arg;
            SoundPlayer sp = new SoundPlayer(file);
            sp.showControls();
            System.out.println("setting gain to " + gain);
            sp.setGain(gain);
            sp.play();
    }

  • [svn:fx-4.0.0] 13647: this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks /build.xml

    Revision: 13647
    Revision: 13647
    Author:   [email protected]
    Date:     2010-01-19 17:04:22 -0800 (Tue, 19 Jan 2010)
    Log Message:
    this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks/build.xml
    QE notes:
    Doc notes:
    Bugs:
    Reviewer:
    Tests run:
    Is noteworthy for integration:
    Modified Paths:
        flex/sdk/branches/4.0.0/frameworks/build.xml

    Hi Renuka,
    The model classes get generated under gen_cmi folder at the time of model import.
    As far I know, the Web Dynpro build operation also re-generates these classes if reqd.
    That is why I asked you to delete the gen_* folder content & do a Project Rebuild operation.
    Or you can delete the model & try importing it again.
    If the problem persists with the generated classes then there is an issue/bug with the generation & I would recommend to raise an OSS message (WD Java component)
    Kind Regards,
    Nitin

  • How To Change Resource Bundle file's data from Java Class

    Hi
    i have used below code for accessing Resource Bndle from Java Class but here i also want to make change in a particular key and its value.
    please let me know the code i should use to make changes in Resource Bundle file's key and value and saving the same in the file.
    package test;  import java.util.Enumeration;
    import java.util.ResourceBundle;
    public class ResourceBundleTest {
    public static void main(String[] args) {
    ResourceBundle rb = ResourceBundle.getBundle("test.bundletest.mybundle");
    Enumeration <String> keys = rb.getKeys();
    while (keys.hasMoreElements()) {
    String key = keys.nextElement();
    String value = rb.getString(key);
    System.out.println(key + ": " + value);
    Thanks

    With further debugging, I noticed the following line only works in integrated WLS but not in standalone WLS
    resourceBundle = ResourceBundle.getBundle("com.myapp.MyMappings");
    I confirmed the corresponding properties file was included properly in the EAR file but the standalone WLS failed to find the properties file at runtime.
    Why did the standalone WLS class loader (must be the same as the integrated WLS) failed to find the properties file deployed under the WEB-INF/classes path in the EAR file?
    The above line was in a POJO class which has the same classpath as the properties file ie. com.myapp.MappingManager.class.
    It was strange that the class loader could load the POJO class but unable to find the com.myapp.MyMappings.properties in the same classpath!!!
    Is this a bug in standalone WLS?
    Edited by: Pricilla on May 26, 2010 8:52 AM
    Edited by: Pricilla on May 26, 2010 9:01 AM

  • Pause before boot sound, should I worry?

    Just yesterday I started noticing that whenever I power up my MacBook Pro it's taking around 15-20 seconds between the time I press the power button and when I hear the Apple bootup sound. During this time the screen is blank and I hear none of the usual startup noises. This only happens when cold booting, not when waking up from sleep. Should I be worried?

    Thanks. I guess what's bugging me is that this only seemed to show up in the last couple of days. Normally (meaning before now) the boot sound was almost instantaneous after I pressed the power button. But perhaps I'm just a little gunshy after reading all the problems other people have had with their MBPs. So far I've not had any (other than the fact that it's hot, but CoreDuoTemp tells me it's not to the point where I have to worry about damaging the processor).
    Week 10 MacBook Pro 2.0gHz Mac OS X (10.4.7) 2GB RAM

  • [svn] 1427: Fix a bug from my previous checkin: For variables that had a primitive value,

    Revision: 1427
    Author: [email protected]
    Date: 2008-04-26 07:47:02 -0700 (Sat, 26 Apr 2008)
    Log Message:
    Fix a bug from my previous checkin: For variables that had a primitive value,
    we were not preserving the variable's attributes, such as static,
    public/protected/private, etc.
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/DManager.java

    This should help you to get started !
    select banner as "Oracle version" from v$version where banner like 'Oracle%';
    create table otn5test(
      id number,
      data xmltype
    insert into otn5test values (1, xmltype('<catalog>
    <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
    </cd>
    <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
    </cd>
    </catalog>
    select otn5test.id, x.*
    from otn5test,
         xmltable('/catalog/cd[artist/text()="Bob Dylan"]' passing otn5test.data
         columns title varchar2(20) path 'title') x;
    select otn5test.id,
           xmlcast(xmlquery('/catalog/cd[artist/text()="Bob Dylan"]/title'
                   passing otn5test.data returning content)
           as varchar2(20)) from otn5test;
    drop table otn5test;
    sqlplus> @otn-5.sql
    Oracle version
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    Table created.
    1 row created.
         ID TITLE
          1 Empire Burlesque
         ID XMLCAST(XMLQUERY('/C
          1 Empire Burlesque
    Table dropped.

  • Storing chinese in client odb from java application

    Hi all,
    first i like to thank Greg Rekounas for his wonderful support and contribution....
    This is my server setup.
    os-windows 2000 sp4
    db-oracle 9ir2 (unicode with AL32UTF8 charset)
    lite-oracle10g r2 (with latest patchset)
    nls_lang- AMERICAN_AMERICA.AL32UTF8
    storing and retriving chinese in oracle 9i database from isql*plus works.
    lite configuration.
    1. In $OLITE_HOME\mobile_oc4j\j2ee\mobileserver\applications
    \mobileserver\setup\common\webtogo\webtogo.ora file edited the JAVA_OPTION
    to:
    JAVA_OPTION=-Djava.compiler=NONE -Dfile.encoding=UTF8
    2. In $OLITE_HOME\mobile_oc4j\j2ee\mobileserver\applications
    \mobileserver\setup\dmc\common\win32.inf file, added the following:
    a. In the <file> section, added the following:
    <item>
    <src>/common/win32/olilUTF8.dll</src>
    <des>$APP_DIR$\bin\olilUTF8.dll</des>
    </item>
    b. In the <ini> section, added the following:
    <item name='POLITE.INI' section='All Databases'>
    <item name="DB_CHAR_ENCODING">UTF8</item>
    </item>
    <item name='POLITE.INI' section='SYNC'>
    <item name="DB_ENCODING">UTF8</item>
    </item>
    published the application developed in java using packaging wizard.
    downloaded the client in the pc with the following config:
    windows 2000 (english)
    nls - default.
    installed chinese language support.
    tried to access 9i database from isql*plus and stored & viewed chinese characters sucessfully.
    tried to store a chinese character from java application in the client odb -- failed.
    values are getting inserted from the application but when i view them back it shows & # 2 6 0 8 5 ; (i have included a space in between all 8 characters.
    but when i copy this no and paste in msword it shows 日(chinese character)
    i dont know the exact reason for the above scenerio...................
    Also please help me on this too.......
    why can i store & view chinese characters sucessfully in isql*plus from the client machine while i cannot do the same on client odb from java application even though the lite config are done to support utf8?
    is anything i left out?
    should i do any codes changes in java?(java application is of verision jdk1.4_13)
    Thanks,
    Ashok kumar.G

    Sorry for late replay!! in the SharePoint server both the Claim based and Classic mode is enabled in the server, but still I want to get authenticated via Classic mode just like it happens in SharePoint  2007 and 2010, so do i have to use a different
    set of classes to do that if yes can you please tell me those ?

  • How to pass the parameter values to the stored procedure from java code?

    I have a stored procedure written in sqlplus as below:
    create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
    I am trying to insert a new row into the database using the stored procedure.
    I have called the above procedure in my java code as below:
    CallableStatement sp = null;
    sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
    How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
    Kindly guide me as I am new to java..

    Java-Queries wrote:
    I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL.

Maybe you are looking for

  • "Artists by Album" column display for iPod (in iTunes 7) doesn't work

    I'm a big fan of the "Artists by Album" column option in iTunes 7, as it helps me to keep my single-artist albums and compilation albums well-sorted and separated from each other. Love it lots; it's my favorite way to view my rather large music colle

  • How To Check File A records in File B

    Hi All, There are two Tables A and B A has only one column(consist of 100 records) and B Has 70 coloumns. I want to check all records of A(1 to 100 records) into B columns (1 to 50 columns) and also count how many records are present in first record

  • Where DTP requests will be stored

    Hi , I know Infopackge requests stored in table RSLDTDONE . But I want the table where DTP  Reqeusts will be stored . Please anybody can help

  • Two Routers off One Cable Modem?

    Can I run two routers off one cable modem, one a hardwired Windows network and the other an Airport Extreme networking a Powerbook G4 and wireless printer?

  • Login module access to third-party libraries?

    G'day, I have a simple login module that is currently deployed in Netweaver 2004s. It is callable by both Netweaver AS and Netweaver Portal, and was implemented using Netweaver Developer Studio. I would like to have this login module use third-party