java.lang.UnsupportedClassVersionError

I have face error in running a compiled java class file.
Exception in thread “main” java.lang.UnsupportedClassVersionError: <class name>
(Unsupported major.minor version 50.0)

This error is caused when you compile a .java file with one version of JDK
and running the .class file with a different version of JVM
(the version of JDK is newer than JVM running .class file).

To check what version of your JDK or JVM, try this

javac -version
=> javac 1.6.0_12

java -version
=> java version “1.4.2_03”
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)

You can see there are different version, because you have install more than one version of java
so to fix this
set path=C:\Program Files\Java\jdk1.6.0_12\bin;%path%

but keep in mind, in c:\windows\system32, there is java.exe, so your path of c:\windows\system32 must place behind
set path=C:\Program Files\Java\jdk1.6.0_12\bin;c:\windows\system32;%path%

Advertisements

Get MAC Address with VB6

List source code to get MAC Address of a computer

Private Const NCBASTAT As Long = &H33
Private Const NCBNAMSZ As Long = 16
Private Const HEAP_ZERO_MEMORY As Long = &H8
Private Const HEAP_GENERATE_EXCEPTIONS As Long = &H4
Private Const NCBRESET As Long = &H32
Private Type NET_CONTROL_BLOCK ‘NCB
ncb_command As Byte
ncb_retcode As Byte
ncb_lsn As Byte
ncb_num As Byte
ncb_buffer As Long
ncb_length As Integer
ncb_callname As String * NCBNAMSZ
ncb_name As String * NCBNAMSZ
ncb_rto As Byte
ncb_sto As Byte
ncb_post As Long
ncb_lana_num As Byte
ncb_cmd_cplt As Byte
ncb_reserve(9) As Byte ‘ Reserved, must be 0
ncb_event As Long
End Type
Private Type ADAPTER_STATUS
adapter_address(5) As Byte
rev_major As Byte
reserved0 As Byte
adapter_type As Byte
rev_minor As Byte
duration As Integer
frmr_recv As Integer
frmr_xmit As Integer
iframe_recv_err As Integer
xmit_aborts As Integer
xmit_success As Long
recv_success As Long
iframe_xmit_err As Integer
recv_buff_unavail As Integer
t1_timeouts As Integer
ti_timeouts As Integer
Reserved1 As Long
free_ncbs As Integer
max_cfg_ncbs As Integer
max_ncbs As Integer
xmit_buf_unavail As Integer
max_dgram_size As Integer
pending_sess As Integer
max_cfg_sess As Integer
max_sess As Integer
max_sess_pkt_size As Integer
name_count As Integer
End Type
Private Type NAME_BUFFER
name As String * NCBNAMSZ
name_num As Integer
name_flags As Integer
End Type
Private Type ASTAT
adapt As ADAPTER_STATUS
NameBuff(30) As NAME_BUFFER
End Type

Private Declare Function Netbios Lib “netapi32.dll” (pncb As NET_CONTROL_BLOCK) As Byte
Private Declare Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” (hpvDest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Private Declare Function GetProcessHeap Lib “kernel32” () As Long
Private Declare Function HeapAlloc Lib “kernel32” (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Function HeapFree Lib “kernel32” (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long

Function GetMACAddress() As String
‘retrieve the MAC Address for the network controller
‘installed, returning a formatted string
Dim tmp As String
Dim pASTAT As Long
Dim NCB As NET_CONTROL_BLOCK
Dim AST As ASTAT
‘The IBM NetBIOS 3.0 specifications defines four basic
‘NetBIOS environments under the NCBRESET command. Win32
‘follows the OS/2 Dynamic Link Routine (DLR) environment.
‘This means that the first NCB issued by an application
‘must be a NCBRESET, with the exception of NCBENUM.
‘The Windows NT implementation differs from the IBM
‘NetBIOS 3.0 specifications in the NCB_CALLNAME field.
NCB.ncb_command = NCBRESET
Call Netbios(NCB)
‘To get the Media Access Control (MAC) address for an
‘ethernet adapter programmatically, use the Netbios()
‘NCBASTAT command and provide a “*” as the name in the
‘NCB.ncb_CallName field (in a 16-chr string).
NCB.ncb_callname = “* ”
NCB.ncb_command = NCBASTAT
‘For machines with multiple network adapters you need to
‘enumerate the LANA numbers and perform the NCBASTAT
‘command on each. Even when you have a single network
‘adapter, it is a good idea to enumerate valid LANA numbers
‘first and perform the NCBASTAT on one of the valid LANA
‘numbers. It is considered bad programming to hardcode the
‘LANA number to 0 (see the comments section below).
NCB.ncb_lana_num = 0
NCB.ncb_length = Len(AST)
pASTAT = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS Or HEAP_ZERO_MEMORY, NCB.ncb_length)
If pASTAT = 0 Then
Debug.Print “memory allocation failed!”
Exit Function
End If
NCB.ncb_buffer = pASTAT
Call Netbios(NCB)
CopyMemory AST, NCB.ncb_buffer, Len(AST)
tmp = Format$(Hex(AST.adapt.adapter_address(0)), “00”) & “-” & Format$(Hex(AST.adapt.adapter_address(1)), “00”) & “-” & Format$(Hex(AST.adapt.adapter_address(2)), “00”) & “-” & Format$(Hex(AST.adapt.adapter_address(3)), “00”) & “-” & Format$(Hex(AST.adapt.adapter_address(4)), “00”) & “-” & Format$(Hex(AST.adapt.adapter_address(5)), “00”)
HeapFree GetProcessHeap(), 0, pASTAT
GetMACAddress = tmp
End Function

Private Sub Form_Load()
Me.Caption = “Network adapter address: ” + GetMACAddress()
End Sub

(this code found when i googling, i don’t remember where anymore ,
this is not code that i created and i don’t claim it.
if someone don’t want to share than don’t use internet, stay at your bed
so i post this code for me to remember and to share this good thing to good people for the good sake)

Counter Strike can’t play on Vista with Intel 950 GMA

I want to play counter strike, but after show splash screen then the game disappear to nowhere. I think my be vista doesn’t compatible or directX. I had updated directX, but nothing happen with the game. So after googgling, i found that to play Counter Strike, there are many mode to launch the game.

So i try to add -d3d, hooray, i can play cs now.

Here the list of cs launch commands :

-noforcemaccel ; Use desktop mouse acceleration settings
-noforcemspd ; Use desktop mouse speed settings.
-noforcemparms ; Use desktop mouse buttons settings.
-noaafonts ; Disables Anti-Aliasing of Screen Fonts.
-heapsize 262144 ; 512MB System Memory
-heapsize 524288 ; 1GB System Memory
-heapsize 1048576 ; 2GB System Memory
-w 640 -h 480 ; 640×480
-w 800 -h 600 ; 800×600
-w 1024 -h 768 ; 1024×768
-full ; Forces the engine to start in fullscreen mode.
-window ; Forces the engine to start in windowed mode.
-freq 100 ; Changes the Hertz for monitors HL1 Engine. CRT 60-100 85=Common LCD 60-75 72=Common
-refresh 100 ; Changes the Hertz for monitors HL2 Engine. CRT 60-100 85=Common LCD 60-75 72=Common
-soft ; This enables Software hardware rendering mode.
-d3d ; This enables Direct3D hardware rendering mode.
-gl ; This enables Open GL hardware rendering mode.
-nojoy ; Remove joystick support, more ram free.
-noipx ; Disables LAN protocall.
-noip ; Some IP related command remove if unable to connect to servers.
-32bpp ; Enables 32Bit rendering.
-16bpp ; Enables 16Bit rendering.
-dxlevel 90 ; DirectX 9
-dxlevel 81 ; DirectX 8.1
-dxlevel 80 ; DirectX 8
-dxlevel 70 ; DirectX 7
-dxlevel 60 ; DirectX 6
-port 27015 ; Changes your port # for the game.
-console ; When launching Half-Life, this will take you straight to the console.
-dev ; This is for developer mode.
-zone # ; This allocates more memory to scripting files, like autoexec.cfg and so forth.
-game [mod’s name] ; Enable Half-Life to play modification games other than to go through the menu to select them.
-safe ; It start the game in safe mode disable audio etc.
-autoconfig ; Restores video and performance settings to default for the current hardware detected.
-condebug ; Logs all console output into the console.log text file.
-nocrashdialog ; Suppresses some ‘memory could not be read’ unhandled errors.
-novid ; When loading a game with this parameter, the intro Valve video will not play.
-toconsole ; Starts the engine directly in the console, unless a map is specified with +map.
+a +r_mmx 1 ; Instead of using a cfg you can launch the game with a command or a cvar in the command line.
+ex_interp 0.01 ; Sets ex_interp value

Just Joke, Operator vs Caller – Chinese Name

Operator :  Hello.

Caller        : Hello, can I speak to Annie Wan (anyone)?

Operator : Yes, you can speak to me.

Caller        : No, I want to speak to Annie Wan (anyone)!

Operator : You are talking to someone! Who is this?

Caller        : I’m Sam Wan (Someone). And I need to talk to Annie Wan (anyone)! It’s urgent.

Operator :  I know you are someone and you want to talk to anyone! But what’s this urgent matter about?

Caller        : Well… just tell my sister Annie Wan (anyone) that our brother Noel Wan (no one), as involved in an accident. Noel Wan (no one)got injured and now Noel Wan (no one) is being sent to the hospital. Right now, Avery Wan (everyone) is on his way to the hospital.

Operator : Look if no one was injured and no one was sent to the hospital,then the accident isn’t an urgent matter! You may find this hilarious but I don’t have time for this!

Caller        : You are so rude! Who are you?

Operator :  I’m Saw Lee (Sorry).

Caller        : Yes! You should be sorry. Now give me your name!!

Install Realtek HD Audio Driver Failure!

I cannot play song in my computer. When i check driver, the property give this message “The drivers for this device are not installed. (Code 28)”. If i re-install the driver, it fail. The Installshield runs for quite a long time, extracting many files and it is almost at the end of a progress bar when it fails.  One error code announced is 0xE0000227, Install Realtek HD Audio Driver Failure!

Then i googgling and found AUD_ALLOS_XP_VISTA_5377_PV_REALTEK.EXE (Microsoft UAA Bus for High Definition Audio sound card).  Before i install, i clear all driver on my computer that related to High Definition Audio Bus Driver then after i install it,i have my computer play songs.

Select Last Row in Oracle

SELECT *
FROM HR.EMPLOYEES
WHERE EMPLOYEE_ID = (SELECT MAX (EMPLOYEE_ID)
FROM HR.EMPLOYEES);

Select Row X to Y in Oracle

the fastest query,

SELECT *
FROM (SELECT A.*, ROWNUM RN
FROM (SELECT *
FROM HR.EMPLOYEES
ORDER BY EMPLOYEE_ID) A
WHERE ROWNUM <= :Y)
WHERE RN >= :X;

another query,
1.SELECT *
FROM (SELECT EMP.*, ROWNUM RN
FROM HR.EMPLOYEES EMP
WHERE ROWNUM < :Y + 1
ORDER BY EMPLOYEE_ID)
WHERE RN BETWEEN :X AND :Y;

2.SELECT *
FROM HR.EMPLOYEES
WHERE EMPLOYEE_ID IN (SELECT EMPLOYEE_ID
FROM HR.EMPLOYEES
GROUP BY ROWNUM, EMPLOYEE_ID
HAVING ROWNUM BETWEEN :X AND :Y)
ORDER BY EMPLOYEE_ID;

3.SELECT *
FROM HR.EMPLOYEES
WHERE ROWID IN (SELECT ROWID
FROM (SELECT * FROM HR.EMPLOYEES ORDER BY EMPLOYEE_ID)
WHERE ROWNUM <= :Y
MINUS
SELECT ROWID
FROM (SELECT * FROM HR.EMPLOYEES ORDER BY EMPLOYEE_ID)
WHERE ROWNUM < :X)